#13853: Correct FreeModule.coordinates() to match specification
----------------------------------+-----------------------------------------
Reporter: Bouillaguet | Owner: jason, was
Type: defect | Status: needs_work
Priority: minor | Milestone: sage-5.8
Component: linear algebra | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers: Timo Kluck
Authors: | Merged in:
Dependencies: | Stopgaps:
----------------------------------+-----------------------------------------
Changes (by tkluck):
* status: needs_review => needs_work
* reviewer: => Timo Kluck
Comment:
I tested your patch. Overall, it looks very good. I like the attention to
detail evident from including a doctest such as
{{{
Wrong arguments are presumably caught with a ``TypeError`` exception::
sage: (ZZ^3).coordinates( QQ )
Traceback (most recent call last):
...
TypeError: can't initialize vector from nonzero non-list
}}}
I tried the examples you gave in the bug description. The first one:
{{{
sage: M = ZZ^3
sage: v = vector(ZZ, [1/2,0,1])
sage: v in M
False
sage: M.coordinates(v)
[1/2, 0, 1]
}}}
already fails with a `TypeError` in the call to `vector`. However, after
replacing `ZZ` by `QQ`, and with your patch applied, the call to
`M.coordinates` gives the desired `ArithmeticError`.
Your second example still gives the same `TypeError`. Maybe that needs
some work, but I don't mind either way. I'll set it to needs-work, but I
would be willing to give a positive review if you would just document the
fact that it could also raise a `TypeError` (depending on "how badly" the
coordinate is outside of the base ring).
There should be a space after the comma in
{{{
sage/modules/free_module.py:
except (TypeError,ArithmeticError):
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13853#comment:7>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.