#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 r.gaia.cs):
Replying to [comment:10 robertwb]:
> Replying to [comment:9 r.gaia.cs]:
> > Replying to [comment:7 robertwb]:
> >
> > I like the idea of see `matrix(str, ...)` try to parse the string. But
I prefer to use `matrix("/path/to/file", ...)` rather than
`matrix(open("/path/to/file", ...), ...)`.
>
> But how would you disambiguate the two?
IMHO, for the string to be parse it must be equal to the nice string
representation of:
* a flat list of elements: {{{'[1, 2, 3, 4]'}}};
* a list of lists (i.e., a list of rows): {{{[[1, 2], [3, 4]]}}};
* a list of Sage vectors: {{{'[(1, 2), (3, 4)]'}}}
* a dictionary having positions as keys and matrix entries as values:
{{{'{(0, 1): 2, (1, 0): 3, (0, 0): 1, (1, 1): 4}'}}}
Once in all the four cases above the 0-position of the string is `[` or
`{` it can be used to disambiguate between the two.
Will be good too that one could do
{{{
matrix("""
1, 2
3, 4
""")
}}}
For this special case we can use the new line character to disambiguate.
> A huge +1 to Volker's idea. #13678
A huge +2 to Volker's idea. #13678
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13601#comment:11>
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.