#9803: Generalize and document the random_matrix constructor
------------------------------+---------------------------------------------
Reporter: rbeezer | Owner: jason, was
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-4.5.3
Component: linear algebra | Keywords:
Author: Rob Beezer | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------------+---------------------------------------------
Changes (by newvalueoldvalue):
* cc: mhansen, wdj, jason (added)
* status: new => needs_review
* author: => Rob Beezer
Old description:
> This will vastly improve the documentation of the {{{random_matrix}}}
> command in common use cases (integers, rationals,...).
>
> It will also allow for new, more specialized constructions, such as Billy
> Wonderly's work at #9720, #9754, #9820.
>
> See #9720 for motivating discussion.
New description:
This will vastly improve the documentation of the {{{random_matrix}}}
command in common use cases (integers, rationals,...).
It will also allow for new, more specialized constructions, such as Billy
Wonderly's work at #9720, #9754, #9802.
See #9720 for motivating discussion.
--
Comment:
Patch expands the functionality of the {{{random_matrix}}} routine. A
matrix space is used to accumulate the base ring, dimensions and
representation (sparse/dense). This can then be passed to the new
{{{random_*_matrix}}} routines where a matrix can actually be constructed
and returned.
Documentation for previous behavior greatly expanded, notably for integer
and rational matrices. New routines are demonstrated, with clear
directions (links, imports) to expanded documentation.
Had to handle density and sparse keywords in a backwards-compatible
fashion, so they are "popped" out of the {{{kwds}}} dictionary and passed
as before to the matrix randomize() routine. The keywords are now
required and won't work as positional arguments. Had to adjust code in
the group theory isomorphism code in a couple of modules as a result.
Also the {{{random_matrix}}} command was employed coincidentally in a
doctest in the lazy import routine. I think the new version works just as
well as a test, so I changed the output.
This code below looks like some artifact of the switch to
allowing/disallowing zero entries. I've left it in, though it *never*
gets called in any of the tests (I checked). Before my changes,
{{{density}}} had a default value of 1, so you would have to consciously
pass in {{{None}}} to make this happen. It was not documented.
{{{
if density is None:
A.randomize(density=float(1), nonzero=False, *args, **kwds)
else:
A.randomize(density=density, nonzero=True, *args, **kwds)
}}}
One fix in mod n dense matrix code. Could not figure out how
{{{range(25)}}} was doing anything useful, and it was ending up in the
algorithm argument, so in the end I just removed it and the affected test
passes.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9803#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.