#13502: vector norm doesn't work with python integers
----------------------------------+-----------------------------------------
       Reporter:  jason           |         Owner:  jason, was     
           Type:  defect          |        Status:  positive_review
       Priority:  major           |     Milestone:  sage-5.4       
      Component:  linear algebra  |    Resolution:                 
       Keywords:                  |   Work issues:                 
Report Upstream:  N/A             |     Reviewers:  Rob Beezer     
        Authors:  Jason Grout     |     Merged in:                 
   Dependencies:                  |      Stopgaps:                 
----------------------------------+-----------------------------------------
Changes (by rbeezer):

  * status:  needs_review => positive_review
  * reviewer:  => Rob Beezer


Old description:

> Since there is a (1/p) calculation in the Cython file, if p is a python
> integer, that (1/p) is 0 (since 1 is also a python integer).
>
> This fix is to make the 1 in 1/p actually a Sage integer, which does the
> right thing.  The 1 is cached at the module level.
>
> Example of wrong behavior:
>
> {{{
> sage: v = vector(QQ, [1,2])
> sage: v.norm(int(2))
> 1
> }}}

New description:

 Since there is a (1/p) calculation in the Cython file, if p is a python
 integer, that (1/p) is 0 (since 1 is also a python integer).

 This fix is to make the 1 in 1/p actually a Sage integer, which does the
 right thing.  The 1 is cached at the module level.

 Example of wrong behavior:

 {{{
 sage: v = vector(QQ, [1,2])
 sage: v.norm(int(2))
 1
 }}}

 '''Apply:'''

 1.  [attachment:trac_13502-vectornorm.patch]

--

Comment:

 Problem confirmed, and solved with patch.  Passes tests on 5.4.beta1.
 Documentation looks fine.

 Positive review.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13502#comment:6>
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.

Reply via email to