Opened 9 years ago

Last modified 7 years ago

#11334 closed task

Update numpy to 1.6.1 — at Version 19

Reported by: jason Owned by: tbd
Priority: major Milestone: sage-5.10
Component: packages: standard Keywords: sd40.5
Cc: fbissey, kini, Snark Merged in:
Authors: Reviewers:
Report Upstream: Fixed upstream, in a later stable release. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Change History (19)

comment:1 Changed 9 years ago by jason

  • Cc fbissey added

CCing fbissey since he's been extremely helpful in previous numpy upgrades.

comment:2 Changed 9 years ago by fbissey

Thx. it looks like numpy has been bumped to 1.6 in Gentoo so I can do some quick compatibility tests. It looks like a flag for gfortran has been added in the ebuild to help with the compiler autodetection madness it may be worth having it sage side too.

Do you know if a scipy release is to follow, if not it would be best to revbump scipy to make sure it is rebuilt after numpy.

Other matter there has been noise about lapack in numpy do we want to disable it, make it optional or keep the status quo?

comment:3 Changed 9 years ago by jason

I don't remember seeing anything on the scipy lists about an imminent scipy release.

comment:4 Changed 9 years ago by fbissey

just in:

sage -t  -long -force_lib "devel/sage/doc/en/numerical_sage/numpy.rst"
**********************************************************************
File "/usr/share/sage/devel/sage/doc/en/numerical_sage/numpy.rst", line 97:
    sage: 2.5*l
Expected:
    array([  0. ,   2.5,   5. ,   7.5,  10. ,  12.5,  15. ,  17.5,  20. ,  22.5])
Got:
    array([0.000000000000000, 2.50000000000000, 5.00000000000000,
           7.50000000000000, 10.0000000000000, 12.5000000000000,
           15.0000000000000, 17.5000000000000, 20.0000000000000,
           22.5000000000000], dtype=object)
**********************************************************************
File "/usr/share/sage/devel/sage/doc/en/numerical_sage/numpy.rst", line 289:
    sage: xx
Expected:
    array([[ 0.  ,  0.25,  0.5 ,  0.75,  1.  ],
           [ 0.  ,  0.25,  0.5 ,  0.75,  1.  ],
           [ 0.  ,  0.25,  0.5 ,  0.75,  1.  ],
           [ 0.  ,  0.25,  0.5 ,  0.75,  1.  ],
           [ 0.  ,  0.25,  0.5 ,  0.75,  1.  ]])
Got:
    array([[0.000000000000000, 0.250000000000000, 0.500000000000000,
            0.750000000000000, 1.00000000000000],
           [0.000000000000000, 0.250000000000000, 0.500000000000000,
            0.750000000000000, 1.00000000000000],
           [0.000000000000000, 0.250000000000000, 0.500000000000000,
            0.750000000000000, 1.00000000000000],
           [0.000000000000000, 0.250000000000000, 0.500000000000000,
            0.750000000000000, 1.00000000000000],
           [0.000000000000000, 0.250000000000000, 0.500000000000000,
            0.750000000000000, 1.00000000000000]], dtype=object)
**********************************************************************
File "/usr/share/sage/devel/sage/doc/en/numerical_sage/numpy.rst", line 295:
    sage: yy
Expected:
    array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ],
           [ 0.25,  0.25,  0.25,  0.25,  0.25],
           [ 0.5 ,  0.5 ,  0.5 ,  0.5 ,  0.5 ],
           [ 0.75,  0.75,  0.75,  0.75,  0.75],
           [ 1.  ,  1.  ,  1.  ,  1.  ,  1.  ]])
Got:
    array([[0.000000000000000, 0.000000000000000, 0.000000000000000,
            0.000000000000000, 0.000000000000000],
           [0.250000000000000, 0.250000000000000, 0.250000000000000,
            0.250000000000000, 0.250000000000000],
           [0.500000000000000, 0.500000000000000, 0.500000000000000,
            0.500000000000000, 0.500000000000000],
           [0.750000000000000, 0.750000000000000, 0.750000000000000,
            0.750000000000000, 0.750000000000000],
           [1.00000000000000, 1.00000000000000, 1.00000000000000,
            1.00000000000000, 1.00000000000000]], dtype=object)
**********************************************************************
File "/usr/share/sage/devel/sage/doc/en/numerical_sage/numpy.rst", line 301:
    sage: f(xx,yy)
Expected:
    array([[ 0.    ,  0.0625,  0.25  ,  0.5625,  1.    ],
           [ 0.0625,  0.125 ,  0.3125,  0.625 ,  1.0625],
           [ 0.25  ,  0.3125,  0.5   ,  0.8125,  1.25  ],
           [ 0.5625,  0.625 ,  0.8125,  1.125 ,  1.5625],
           [ 1.    ,  1.0625,  1.25  ,  1.5625,  2.    ]])
Got:
    array([[0.000000000000000, 0.0625000000000000, 0.250000000000000,
            0.562500000000000, 1.00000000000000],
           [0.0625000000000000, 0.125000000000000, 0.312500000000000,
            0.625000000000000, 1.06250000000000],
           [0.250000000000000, 0.312500000000000, 0.500000000000000,
            0.812500000000000, 1.25000000000000],
           [0.562500000000000, 0.625000000000000, 0.812500000000000,
            1.12500000000000, 1.56250000000000],
           [1.00000000000000, 1.06250000000000, 1.25000000000000,
            1.56250000000000, 2.00000000000000]], dtype=object)
**********************************************************************
2 items had failures:
   1 of  55 in __main__.example_0
   3 of  13 in __main__.example_1
***Test Failed*** 4 failures.

there may be more

comment:5 Changed 9 years ago by fbissey

  • Description modified (diff)

I have cut a new spkg for 1.6.0, I decided to go for plain update for now.

comment:6 Changed 9 years ago by fbissey

seems my home install has problems. Probably stuff messed around between python 2.6 and 2.7 because I am working on #9958. Another install didn't report any problems. So I will check on a vanilla sage but I think we won't need to do any patching.

comment:7 Changed 9 years ago by fbissey

For some reason the other install didn't upgrade that's why I didn't see anything on the second machine. So right now it looks like we have the following to correct:

        sage -t  -long -force_lib devel/sage/doc/en/numerical_sage/numpy.rst #
 4 doctests failed
         sage -t  -long -force_lib devel/sage/sage/symbolic/function.pyx # 1
 doctests failed
         sage -t  -long -force_lib devel/sage/sage/plot/plot_field.py # 1
 doctests failed
         sage -t  -long -force_lib devel/sage/sage/plot/matrix_plot.py # 1
 doctests failed
         sage -t  -long -force_lib devel/sage/sage/matrix/matrix1.pyx # 1
 doctests failed
         sage -t  -long -force_lib devel/sage/sage/numerical/optimize.py # 1
 doctests failed
         sage -t  -long -force_lib devel/sage/sage/rings/integer.pyx # 1
 doctests failed
         sage -t  -long -force_lib devel/sage/sage/functions/hyperbolic.py # 2
 doctests failed
         sage -t  -long -force_lib devel/sage/sage/functions/trig.py # 3
 doctests failed
         sage -t  -long -force_lib devel/sage/sage/functions/other.py # 2
 doctests failed

The first one is already in the ticket, then we have

sage -t -long -force_lib "devel/sage/sage/symbolic/function.pyx"
**********************************************************************
File "/usr/share/sage/devel/sage/sage/symbolic/function.pyx", line 596:
    sage: csc(a)
Expected:
    array([        inf,  1.18839511,  1.09975017,  7.0861674 , -1.32134871])
Got:
    doctest:270: RuntimeWarning: divide by zero encountered in divide
    array([        inf,  1.18839511,  1.09975017,  7.0861674 , -1.32134871])
**********************************************************************
sage -t -long -force_lib "devel/sage/sage/plot/plot_field.py"
**********************************************************************
File "/usr/share/sage/devel/sage/sage/plot/plot_field.py", line 216:
    sage: plot_slope_field(growth_rate*(1-y/capacity)*y, (x,0,5), (y,0,capacity*2)).show(aspect_ratio=1)
Expected nothing
Got:
    doctest:622: RuntimeWarning: divide by zero encountered in divide
    doctest:623: RuntimeWarning: invalid value encountered in multiply
    doctest:624: RuntimeWarning: invalid value encountered in multiply
**********************************************************************
sage -t -long -force_lib "devel/sage/sage/plot/matrix_plot.py"
**********************************************************************
File "/usr/share/sage/devel/sage/sage/plot/matrix_plot.py", line 383:
    sage: matrix_plot([[sin(x), cos(x)], [1, 0]])
Expected:
    Traceback (most recent call last):
    ...
    ValueError: can not convert entries to floating point numbers
Got:
    Traceback (most recent call last):
      File "/usr/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/usr/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/usr/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_8[36]>", line 1, in <module>
        matrix_plot([[sin(x), cos(x)], [Integer(1), Integer(0)]])###line 383:
    sage: matrix_plot([[sin(x), cos(x)], [1, 0]])
      File "/usr/lib/python2.7/site-packages/sage/misc/decorators.py", line 381, in wrapper
        return func(*args, **kwds)
      File "/usr/lib/python2.7/site-packages/sage/misc/decorators.py", line 432, in wrapper
        return func(*args, **options)
      File "/usr/lib/python2.7/site-packages/sage/plot/matrix_plot.py", line 423, in matrix_plot
        raise TypeError, "mat must be a Matrix or a two dimensional array"
    TypeError: mat must be a Matrix or a two dimensional array
**********************************************************************
sage -t -long -force_lib "devel/sage/sage/matrix/matrix1.pyx"
**********************************************************************
File "/usr/share/sage/devel/sage/sage/matrix/matrix1.pyx", line 468:
    sage: sorted(numpy.typecodes.items())
Expected:
    [('All', '?bhilqpBHILQPfdgFDGSUVO'), ('AllFloat', 'fdgFDG'), ('AllInteger', 'bBhHiIlLqQpP'), ('Character', 'c'), ('Complex', 'FDG'), ('Float', 'fdg'), ('Integer', 'bhilqp'), ('UnsignedInteger', 'BHILQP')]
Got:
    [('All', '?bhilqpBHILQPefdgFDGSUVOMm'), ('AllFloat', 'efdgFDG'), ('AllInteger', 'bBhHiIlLqQpP'), ('Character', 'c'), ('Complex', 'FDG'), ('Datetime', 'Mm'), ('Float', 'efdg'), ('Integer', 'bhilqp'), ('UnsignedInteger', 'BHILQP')]
**********************************************************************
sage -t -long -force_lib "devel/sage/sage/numerical/optimize.py"
**********************************************************************
File "/usr/share/sage/devel/sage/sage/numerical/optimize.py", line 162:
    sage: find_minimum_on_interval(f, 1, 5, tol=1e-3)
Expected:
    (-3.28837136189098..., 3.42575079030572...)
Got:
    (-3.28837136189, 3.4257507903057229)
sage -t -long -force_lib "devel/sage/sage/rings/integer.pyx"
**********************************************************************
File "/usr/share/sage/devel/sage/sage/rings/integer.pyx", line 4738:
    sage: numpy.array(2**40).dtype
Expected:
    dtype('int64')
Got:
    dtype('object')
**********************************************************************
sage -t -long -force_lib "devel/sage/sage/functions/hyperbolic.py"
**********************************************************************
File "/usr/share/sage/devel/sage/sage/functions/hyperbolic.py", line 609:
    sage: arcsech(a)
Exception raised:
    Traceback (most recent call last):
      File "/usr/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/usr/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/usr/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_23[4]>", line 1, in <module>
        arcsech(a)###line 609:
    sage: arcsech(a)
      File "function.pyx", line 357, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:3794)
      File "/usr/lib/python2.7/site-packages/sage/functions/hyperbolic.py", line 612, in _eval_numpy_
        return arccosh(1.0 / x)
    ZeroDivisionError: float division by zero
**********************************************************************
File "/usr/share/sage/devel/sage/sage/functions/hyperbolic.py", line 658:
    sage: arccsch(a)
Exception raised:
    Traceback (most recent call last):
      File "/usr/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/usr/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/usr/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_26[4]>", line 1, in <module>
        arccsch(a)###line 658:
    sage: arccsch(a)
      File "function.pyx", line 357, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:3794)
      File "/usr/lib/python2.7/site-packages/sage/functions/hyperbolic.py", line 661, in _eval_numpy_
        return arcsinh(1.0 / x)
    ZeroDivisionError: float division by zero
**********************************************************************
sage -t -long -force_lib "devel/sage/sage/functions/trig.py"
**********************************************************************
File "/usr/share/sage/devel/sage/sage/functions/trig.py", line 827:
    sage: atan2(a, b)
Exception raised:
    Traceback (most recent call last):
      File "/usr/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/usr/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/usr/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_34[16]>", line 1, in <module>
        atan2(a, b)###line 827:
    sage: atan2(a, b)
      File "function.pyx", line 718, in sage.symbolic.function.GinacFunction.__call__ (sage/symbolic/function.cpp:6475)
      File "function.pyx", line 357, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:3794)
      File "function.pyx", line 604, in sage.symbolic.function.Function._eval_numpy_ (sage/symbolic/function.cpp:5568)
    NotImplementedError: The Function arctan2 does not support numpy arrays as arguments
**********************************************************************
File "/usr/share/sage/devel/sage/sage/functions/trig.py", line 830:
    sage: atan2(1,a)
Exception raised:
    Traceback (most recent call last):
      File "/usr/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/usr/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/usr/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_34[17]>", line 1, in <module>
        atan2(Integer(1),a)###line 830:
    sage: atan2(1,a)
      File "function.pyx", line 718, in sage.symbolic.function.GinacFunction.__call__ (sage/symbolic/function.cpp:6475)
      File "function.pyx", line 357, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:3794)
      File "function.pyx", line 604, in sage.symbolic.function.Function._eval_numpy_ (sage/symbolic/function.cpp:5568)
    NotImplementedError: The Function arctan2 does not support numpy arrays as arguments
**********************************************************************
File "/usr/share/sage/devel/sage/sage/functions/trig.py", line 833:
    sage: atan2(a, 1)
Exception raised:
    Traceback (most recent call last):
      File "/usr/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/usr/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/usr/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_34[18]>", line 1, in <module>
        atan2(a, Integer(1))###line 833:
    sage: atan2(a, 1)
      File "function.pyx", line 718, in sage.symbolic.function.GinacFunction.__call__ (sage/symbolic/function.cpp:6475)
      File "function.pyx", line 357, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:3794)
      File "function.pyx", line 604, in sage.symbolic.function.Function._eval_numpy_ (sage/symbolic/function.cpp:5568)
    NotImplementedError: The Function arctan2 does not support numpy arrays as arguments
**********************************************************************
sage -t -long -force_lib "devel/sage/sage/functions/other.py"
**********************************************************************
File "/usr/share/sage/devel/sage/sage/functions/other.py", line 211:
    sage: ceil(a)
Exception raised:
    Traceback (most recent call last):
      File "/usr/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/usr/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/usr/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_5[20]>", line 1, in <module>
        ceil(a)###line 211:
    sage: ceil(a)
      File "/usr/lib/python2.7/site-packages/sage/functions/other.py", line 251, in __call__
        return numpy.ceil(x)
    AttributeError: ceil
**********************************************************************
File "/usr/share/sage/devel/sage/sage/functions/other.py", line 366:
    sage: floor(a)
Exception raised:
    Traceback (most recent call last):
      File "/usr/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/usr/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/usr/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_9[15]>", line 1, in <module>
        floor(a)###line 366:
    sage: floor(a)
      File "/usr/lib/python2.7/site-packages/sage/functions/other.py", line 405, in __call__
        return numpy.floor(x)
    AttributeError: floor
**********************************************************************

The last three are particularly concerning, could you check what's up with these in numpy?

comment:8 Changed 9 years ago by kcrisman

This seems to have installed fine on OS X 10.4 PPC. I'm running doctests now (which will take a LONG time) but I did already see the matrix/matrix1.pyx one while testing something else.

comment:9 Changed 9 years ago by fbissey

That's good that it at least install. On gentoo there are interactions problem between numpy and scipy to get cblas/blas/lapack right in scipy. I should check if the resulting scipy in vanilla sage suffers from the same problem. http://bugs.gentoo.org/show_bug.cgi?id=371099

The last few failing tests are show stoppers as far as I am concerned.

comment:10 Changed 9 years ago by kcrisman

Okay, I got pretty much the same failures on a long run. One weird thing... did we change find_minimum_on_interval away from SciPy recently? This is the full output I get on the (otherwise same as your failure) test for that.

    sage: find_minimum_on_interval(f, 1, 5, tol=1e-3)
Expected:
    (-3.28837136189098..., 3.42575079030572...)
Got:
    (-3.28837136189, 3.4257507903057229)
GLPK Simplex Optimizer, v4.44
6 rows, 3 columns, 8 non-zeros
Preprocessing...
2 rows, 2 columns, 4 non-zeros
Scaling...
 A: min|aij| =  2.400e+01  max|aij| =  5.000e+01  ratio =  2.083e+00
GM: min|aij| =  8.128e-01  max|aij| =  1.230e+00  ratio =  1.514e+00
EQ: min|aij| =  6.606e-01  max|aij| =  1.000e+00  ratio =  1.514e+00
Constructing initial basis...
Size of triangular part = 2
*     0: obj =  -5.100000000e+01  infeas =  0.000e+00 (0)
*     1: obj =  -5.225000000e+01  infeas =  0.000e+00 (0)
OPTIMAL SOLUTION FOUND

comment:11 Changed 9 years ago by fbissey

1.6.1 is now available. I'll have a look sometimes this week.

comment:12 Changed 9 years ago by fbissey

Looks like more of the same but maybe a little bit more. There are a few other things that may interfere on my setup and I had to solve that bit: http://bugs.gentoo.org/show_bug.cgi?id=371099 before doing the trial.

comment:13 Changed 9 years ago by fbissey

Once I had cleared a few blas problem that I had while solving the gentoo bug. I get exactly the same results. I also get the output from Karl in optimize. This is a verbose output of glpk which get called at some point. You only get to see the such verbose output if there was a failure in the test but not necessarily the test for which glpk is called funnily enough.

comment:14 Changed 9 years ago by fbissey

Should we try to move forward on this again? I will have a go at trying it with 4.8.alpha2. Any ideas about the current failures?

comment:15 Changed 9 years ago by fbissey

Ok this is still broken in 4.8.alpha2. Some food for thought

sage
----------------------------------------------------------------------
| Sage Version 4.8.alpha2, Release Date: 2011-11-19                  |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
**********************************************************************
*                                                                    *
* Warning: this is a prerelease version, and it may be unstable.     *
*                                                                    *
**********************************************************************
sage: import numpy
sage: a = numpy.linspace(0,2,6)
sage: a
array([0.0, 0.4, 0.8, 1.2, 1.6, 2], dtype=object)
sage: ceil(a)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/fbissey/<ipython console> in <module>()

/usr/lib64/python2.7/site-packages/sage/functions/other.py in __call__(self, x, maximum_bits)
    250             elif type(x).__module__ == 'numpy':
    251                 import numpy
--> 252                 return numpy.ceil(x)
    253 
    254         x_original = x

AttributeError: ceil

with numpy-1.5.1 we just have

sage: a
array([0.0, 0.4, 0.8, 1.2, 1.6, 2])

I suspect that for this one (functions/other.py) and functions/trig.py the pynac interface may need to be touched. All stuff that takes an numpy array and return a numpy array may have trouble.

comment:16 Changed 9 years ago by fbissey

Just to add a bit of info. Same python and ipython

ipython
Python 2.7.2 (default, Oct 28 2011, 11:36:16) 
Type "copyright", "credits" or "license" for more information.

IPython 0.10.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import numpy

In [2]: a = numpy.linspace(0,2,6)

In [3]: a
Out[3]: array([ 0. ,  0.4,  0.8,  1.2,  1.6,  2. ])

In [4]: ceil(a)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/home/fbissey/<ipython console> in <module>()

NameError: name 'ceil' is not defined

In [5]: numpy.ceil(a)
Out[5]: array([ 0.,  1.,  1.,  2.,  2.,  2.])

So it works in ipython but we don't have the dtype=object attached to the array. Anyone knows what that means actually?

comment:17 Changed 9 years ago by fbissey

numpy-1.5.1

sage: numpy.dtype(a[1])
dtype('float64')

numpy-1.6.1

sage: numpy.dtype(a[1])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/fbissey/<ipython console> in <module>()

TypeError: data type not understood

comment:18 Changed 9 years ago by fbissey

sage: type(a[0])
<type 'float'>
sage: type(a[0:5])
<type 'numpy.ndarray'>
sage: type(a[2])
<type 'float'>
sage: type(a[3])
<type 'float'>
sage: type(a[4])
<type 'float'>
sage: type(a[5])
<type 'sage.rings.integer.Integer'>

For some reason numpy.linspace return an array with sage objects rather than just floats. I am guessing it may be deeper than that. Numpy probably uses sage types rather than converting to numpy types. The types of a[0] to a[4] is strange, is there a sage type for floats? I mean I tried numpy.linspace(0,2.0,6) and I got <type 'sage.rings.real_mpfr.RealNumber?'> for a[0] to a[4] and <type 'sage.rings.real_mpfr.RealLiteral?'> for a[5].

Doing a cast numpy.array(a,dtype=float) returns something that will work.

comment:19 Changed 8 years ago by fbissey

  • Description modified (diff)
  • Summary changed from Update numpy to 1.6 to Update numpy to 1.6.1
Note: See TracTickets for help on using tickets.