#13601: Module to load matrix from file
----------------------------------+-----------------------------------------
Reporter: r.gaia.cs | Owner: jason, was
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-5.5
Component: linear algebra | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
----------------------------------+-----------------------------------------
Comment (by vbraun):
To parse a string-matrix I think we should just match numbers and strip
everything else out, as in
{{{
sage: number = re.compile('[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?')
sage: [ match.group() for match in number.finditer('[ 1e3, 0 | 3 6, 1.3
.123)') ]
['1e3', '0', '3', '6', '1.3', '.123']
}}}
Then put the numbers from each line into the rows of a matrix. This should
grok all ascii-art matrix representations.
If the input string is already valid Python, say, then the user can just
eval it directly. So we shouldn't worry too much about that case.
+1 to use `matrix.load()` to load the matrix.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13601#comment:13>
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.