#9720: Add random echelonizable matrices to matrix/constructor.py
------------------------------+---------------------------------------------
Reporter: bwonderly | Owner: jason, was
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.5.3
Component: linear algebra | Keywords:
Author: Billy Wonderly | Upstream: N/A
Reviewer: David Joyner | Merged:
Work_issues: |
------------------------------+---------------------------------------------
Comment(by rbeezer):
Replying to [comment:21 jason]:
> To take care of the namespace issue, what about making it work like
graphs does? In other words, "random_matrix" behaves like it always has,
and "random_matrix.echelonizable(...)", "random_matrix.unimodular()",
etc., do the specialized functions?
>
> I'm a slight -1 on making random_matrix take a ton of options, a lot of
which may be mutually exclusive. For example, if I ask for a random
echelonizable matrix over ZZ, with a specific range of entries, will it
work?
Right now I'm thinking:
{{{
random_matrix(RR, 6, 4, algorithm='randomize')
random_matrix(ZZ, 6, 4, algorithm='echelon_form')
random_matrix(ZZ, 3, 4, algorithm='echelonizable')
random_matrix(ZZ, 8, 8, algorithm='diagonalizable')
}}}
etc. {{{random_matrix()}}} would be a big switch on the value of
{{{algorithm}}}. Default would be 'randomize' and preserve current
behavior. {{{random_matrix()}}} would throw errors for "wrong" rings, or
"wrong" shapes.
{{{random_matrix()}}} would have one good example of each type, with link
to actual routine's documentation for PDF & HTL version. For notebook or
CL docs, the documentation would say "use
sage.constructor.random_echelonizable_matrix?" for more detailed
documentation right after the example (not tested).
{{{random_matrix()}}} already takes lots of options - anything the
randomize function of the entry type accepts. I think the new functions
only accept {{{upper_bound}}} as an option, as a type of what Billy calls
"size control". Currently, the possibilities for arguments is not handled
very well:
{{{
sage: random_matrix(QQ, 3, 4, num_bound = 4, den_bound = 10)
[-3/8 -3/5 1 -4/7]
[ 3/2 2/3 -2 -1/2]
[-1/8 1/2 1/8 -3/8]
sage: random_matrix(ZZ, 3, 4, num_bound = 4, den_bound = 10)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/sage/dev/devel/sage-main/<ipython console> in <module>()
/sage/dev/local/lib/python2.6/site-packages/sage/matrix/constructor.pyc in
random_matrix(R, nrows, ncols, sparse, density, *args, **kwds)
829 A.randomize(density=float(1), nonzero=False, *args,
**kwds)
830 else:
--> 831 A.randomize(density=density, nonzero=True, *args, **kwds)
832 return A
833
/sage/dev/local/lib/python2.6/site-
packages/sage/matrix/matrix_integer_dense.so in
sage.matrix.matrix_integer_dense.Matrix_integer_dense.randomize
(sage/matrix/matrix_integer_dense.c:23941)()
TypeError: randomize() got an unexpected keyword argument 'num_bound'
}}}
I'm -1 to implementing the whole graphs-dot infrastructure for just five
or six functions right as Billy is trying to wrap this up. (And possibly
having to deprecate any current behavior.) I do want to (but have not
found the time yet) to implement the dot-syntax for groups.
Just a thought - we could implement a whole random-dot hierarchy:
matrices, primes, graphs,....
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9720#comment:23>
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.