upiterbarg / mpmath

Automatically exported from code.google.com/p/mpmath
Other
0 stars 0 forks source link

use numpy for fp matrix arithmetic #177

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Were in the code should this be implemented? ctx_fp.py? The probably some code 
has to be 
moved.

Original issue reported on code.google.com by Vinzent.Steinberg@gmail.com on 17 Jan 2010 at 8:35

GoogleCodeExporter commented 9 years ago
Maybe the matrix class can be split into two classes at the implementation 
level? The
inner class could use a numpy-compatible interface, so numpy.array could just be
swapped in, and the outer class could provide the mpmath interface? The 
semantics of
the most basic matrix operations should be equivalent. Even mp could use numpy 
when
available, just for the benefit of slightly faster array operations. So I think 
most
of this could be done in matrices.py. (mp would just have to override __mul__ 
for the
faster fdot-based version)

For lu_solve and similar methods, I think ctx_fp.py would be the right place to
overload the default ones.

Original comment by fredrik....@gmail.com on 17 Jan 2010 at 9:01

GoogleCodeExporter commented 9 years ago
Wouldn't we get numpy as a dependency this way?

Original comment by Vinzent.Steinberg@gmail.com on 17 Jan 2010 at 9:21

GoogleCodeExporter commented 9 years ago
Not any different from gmpy.

try:
    import numpy
    have_numpy = True
except ImportError:
    have_numpy = False

Original comment by fredrik....@gmail.com on 17 Jan 2010 at 9:26