#10364: Vector constructor improvements
------------------------------+---------------------------------------------
Reporter: rbeezer | Owner: jason, was
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: linear algebra | Keywords:
Author: Rob Beezer | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------------+---------------------------------------------
Patch creates a `zero_vector` constructor, mirroring the `zero_matrix`
constructor. It adds error-checking to the `vector` constructor for the
case of a negative degree.
Finally, it adds a new, more informative error message when a dictionary
is used for the entries of a (sparse) vector and a degree is given.
Presently, the following syntax executes without an error, though the
result would not be what we should expect. This "works" since the
dictionary has "length" 3.
{{{
sage: vector(QQ, 3, {0:0, 2:5, 12:-1})
(0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1)
}}}
This could be improved further by adjusting the `prepare_dict` method to
accept an optional integer degree for the number of entries. Then instead
of an error we could have the (fictional) behavior:
{{{
sage: vector(QQ, 6, {1:2, 4:-3})
(0, 2, 0, 0, -3, 0)
}}}
This depends on #10362 since one doctest there has changed in this patch.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10364>
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.