#18076: Be nicer with numpy
-------------------------------------+-------------------------------------
       Reporter:  vdelecroix         |        Owner:  vdelecroix
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.6
      Component:  interfaces         |   Resolution:
       Keywords:  sd66               |    Merged in:
        Authors:  Vincent Delecroix  |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/vdelecroix/18076                 |  1d2148e8a0eb2dbfd3575f209ced87626e84c6b1
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Description changed by vdelecroix:

Old description:

> Plenty of bugs have been reported for the interaction with numpy:
> - #8426: polynomial * constant does not work if constant is a numpy type
> - #8949: symbolic functions dont work with numpy.int32
> - #9769: symbolic function do not work with numpy.int64 arguments
> - #13386: comparison of Sage integer with Numpy integer
> - #15695: Coercion problems between numpy and sage floats
> - #17758: Intervals and numpy floats do not compare correctly
> - #17865: get rid of _native_coercion_ranks_inv and
> _native_coercion_ranks
>
> We solve them all by defining coercions of numpy integers to `ZZ`, numpy
> floating to `RDF` and numpy complex floating to `CDF`. Also, coercion
> between numerical types (in `sage.structure.coerce`) are now done
> directly via the addition.
>
> Some of them depend on modifying some internal in numpy and will not be
> solved here:
> - #8824: Make it so that numpy datatypes are integrated into the coercion
> model

New description:

 Plenty of bugs have been reported for the interaction with numpy:
 - #8426: polynomial * constant does not work if constant is a numpy type
 - #8949: symbolic functions dont work with numpy.int32
 - #9769: symbolic function do not work with numpy.int64 arguments
 - #13386: comparison of Sage integer with Numpy integer
 - #15695: Coercion problems between numpy and sage floats
 - #17758: Intervals and numpy floats do not compare correctly
 - #17865: get rid of _native_coercion_ranks_inv and _native_coercion_ranks

 We solve them all by defining coercions of numpy integers to `ZZ`, numpy
 floating to `RDF` and numpy complex floating to `CDF`. Also, coercion
 between numerical types (in `sage.structure.coerce`) are now done directly
 via the addition. In particular, all of this used to fail
 {{{
 sage: import numpy

 sage: f(t) = t^2
 sage: f(numpy.int32('1'))
 1

 sage: sin(numpy.int32(10))
 sin(10)

 sage: 123 == numpy.int32(123)
 True

 sage: 1j + numpy.float(2)
 2.00000000000000 + 1.00000000000000*I
 sage: parent(_)
 Complex Field with 53 bits of precision

 sage: RIF(1) <= numpy.float64(2.0)
 True
 }}}

 Some of them depend on modifying some internal in numpy and will not be
 solved here:
 - #8824: Make it so that numpy datatypes are integrated into the coercion
 model

--

--
Ticket URL: <http://trac.sagemath.org/ticket/18076#comment:8>
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to