#3893: random_element methods should all accept *args and **kwds
--------------------------------+-------------------------------------------
Reporter: malb | Owner: somebody
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-4.5.3
Component: basic arithmetic | Keywords:
Author: Niles Johnson | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------------+-------------------------------------------
Changes (by newvalueoldvalue):
* status: new => needs_review
* upstream: => N/A
* author: => Niles Johnson
Comment:
I've reinterpreted this ticket as "random_element methods which call other
random_element methods should pass on *args and **kwds". This applies
mostly to `sage.rings`, but also a few other cases. The list below shows
the output of `sage: search_src("def random_element")`, annotated by the
changes this patch makes.
`make ptestlong` passes all tests, and documentation builds without errors
or warnings. Details below.
Note that #9481 fixes `random_element` for univariate power series rings,
and I've ignored padics since there is a large revision in process: e.g.
#6084 and #5075.
* algebras/quatalg/quaternion_algebra.py:448: def random_element(self,
*args, **kwds):
* nothing to fix
* algebras/quatalg/quaternion_algebra.py:1142: def
random_element(self, *args, **kwds):
* nothing to fix
* categories/enumerated_sets.py:472: def random_element(self):
* not implemented
* categories/infinite_enumerated_sets.py:83: def
random_element(self):
* not implemented
* coding/linear_code.py:2022: def random_element(self):
* FIXED
* combinat/cartesian_product.py:177: def random_element(self):
* doesn't call other random_element()
* combinat/choose_nk.py:148: def random_element(self):
* doesn't call other random_element()
* combinat/multichoose_nk.py:90: def random_element(self):
* doesn't call other random_element()
* combinat/partition.py:3269: def random_element(self, measure =
'uniform'):
* doesn't call other random_element()
* combinat/partition.py:3297: def random_element_uniform(self):
* doesn't call other random_element()
* combinat/partition.py:3360: def random_element_plancherel(self):
* doesn't call other random_element()
* combinat/permutation.py:2792: def random_element(self):
* doesn't call other random_element()
* combinat/permutation.py:2991: def random_element(self):
* doesn't call other random_element()
* combinat/permutation.py:3110: def random_element(self):
* doesn't call other random_element()
* combinat/permutation.py:3334: def random_element(self):
* doesn't call other random_element()
* combinat/permutation_nk.py:112: def random_element(self):
* doesn't call other random_element()
* combinat/split_nk.py:113: def random_element(self):
* doesn't call other random_element()
* combinat/subset.py:238: def random_element(self):
* doesn't call other random_element()
* combinat/subset.py:485: def random_element(self):
* calls random_element() of ChooseNK from sage.combinat.choose_nk, and
that method takes no arguments
* combinat/tableau.py:2162: def random_element(self):
* doesn't call other random_element()
* crypto/mq/mpolynomialsystemgenerator.py:184: def
random_element(self):
* not implemented
* crypto/mq/sr.py:1089: def random_element(self, elem_type =
"vector"):
* FIXED
* groups/group.pyx:196: def random_element(self, bound=None):
* not implemented
* groups/abelian_gps/abelian_group.py:854: def random_element(self):
* doesn't call other random_element()
* groups/abelian_gps/abelian_group_element.py:312: def
random_element(self):
* doesn't call other random_element()
* groups/abelian_gps/dual_abelian_group.py:221: def
random_element(self):
* doesn't call other random_element()
* groups/matrix_gps/matrix_group.py:643: def random_element(self):
* doesn't call other random_element()
* groups/perm_gps/permgroup.py:1107: def random_element(self):
* doesn't call other random_element()
* matrix/matrix_space.py:1221: def random_element(self, density=None,
*args, **kwds):
* nothing to fix
* modular/dirichlet.py:2290: def random_element(self):
* doesn't call other random_element()
* modular/arithgroup/congroup_sl2z.py:142: def random_element(self,
bound=100):
* nothing to fix
* DONE: modules/free_module.py:1710: def random_element(self,
prob=1.0, *args, **kwds):
* FIXED
* modules/free_module.py:4147: def random_element(self, prob=1.0,
*args, **kwds):
* FIXED
* modules/fg_pid/fgp_module.py:1307: def random_element(self, *args,
**kwds):
* FIXED
* rings/complex_double.pyx:214: def random_element(self, double
xmin=-1, double xmax=1, double ymin=-1, double ymax=1):
* doesn't call any other random_element() method
* rings/complex_field.py:421: def random_element(self,
component_max=1):
* FIXED
* rings/complex_interval_field.py:334: def random_element(self,
*args):
* FIXED
* rings/contfrac.py:331: def random_element(self, num_bound=2,
den_bound=2):
* FIXED
* rings/fraction_field.py:573: def random_element(self, *args,
**kwds):
* nothing to fix
* rings/integer_ring.pyx:511: def random_element(self, x=None, y=None,
distribution=None):
* doesn't call any other random_element() method
* rings/pari_ring.py:58: def random_element(self, bound=0):
* always returns 0
* rings/power_series_ring.py:622: def random_element(self, prec=None,
*args, **kwds):
* fixed by #9481
* rings/rational_field.py:762: def random_element(self,
num_bound=None, den_bound=None, distribution=None):
* FIXED
* rings/real_double.pyx:406: def random_element(self, double min=-1,
double max=1):
* doesn't call any other random_element() method
* rings/ring.pyx:865: def random_element(self, bound=2):
* uses python's randint instead of ZZ.random_element()
* (this has the disadvantage of not allowing one to specify the
distribution, but probably no one cares)
* rings/real_mpfi.pyx:666: def random_element(self, *args):
* FIXED
* rings/real_mpfr.pyx:884: def random_element(self, min=-1, max=1,
distribution=None):
* doesn't call any other random_element() method
* rings/finite_rings/element_givaro.pyx:352: def random_element(self,
*args, **kwds):
* nothing to fix
* rings/finite_rings/finite_field_base.pyx:569: def
random_element(self, bound=None):
* FIXED
* rings/finite_rings/finite_field_givaro.py:180: def
random_element(self, *args, **kwds):
* nothing to fix
* rings/finite_rings/integer_mod_ring.py:1061: def
random_element(self, bound=None):
* calls sage.rings.CommutativeRing.random_element(), whose only
allowed argument is 'bound'
* rings/number_field/number_field.py:1247: def random_element(self,
num_bound=None, den_bound=None,
* calls _random_element() method of
sage.rings.number_field.number_field_element.NumberFieldElement_absolute,
and already includes all possible keyword arguments
* rings/number_field/number_field_ideal.py:1132: def
random_element(self, *args, **kwds):
* nothing to fix
* rings/number_field/order.py:858: def random_element(self, *args,
**kwds):
* nothing to fix
* rings/padics/generic_nodes.py:265: def random_element(self,
algorithm='default'):
* not touching padics (see above)
* rings/padics/padic_base_leaves.py:508: def random_element(self,
algorithm='default'):
* not touching padics (see above)
* rings/padics/padic_extension_generic.py:286: def
random_element(self):
* not touching padics (see above)
* rings/polynomial/laurent_polynomial_ring.py:707: def
random_element(self, low_degree = -2, high_degree = 2, terms = 5,
choose_degree=False,*args, **kwds):
* nothing to fix
* rings/polynomial/multi_polynomial_ring_generic.pyx:585: def
random_element(self, degree=2, terms=None, choose_degree=False,*args,
**kwargs):
* (added by #1956) nothing to fix
* rings/polynomial/pbori.pyx:899: def random_element(self,
degree=None, terms=None, choose_degree=True, vars_set=None):
* doesn't call any other random_element() method
* rings/polynomial/polynomial_quotient_ring.py:591: def
random_element(self, *args, **kwds):
* nothing to fix
* rings/polynomial/polynomial_ring.py:883: def random_element(self,
degree=2, *args, **kwds):
* nothing to fix
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/3893#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.