From: Bill B. <wb...@gm...> - 2006-02-20 06:12:46
|
This url http://www.rexx.com/~dkuhlman/scipy_course_01.html seems to keep turning up in my searches for numpy and scipy things, but many of the linalg operations it lists don't seem to exist in recent versions of numpy (or scipy). Some of them are: * norm * factorizations: lu, lu_factor, lu_solve, qr * iterative solvers: cg, cgs, gmres etc. Did these things used to exist in Numeric but they haven't been ported over? Will they be re-introduced sometime? In the short term, the one I'm after right now is LU decompose and solve functionality. Anyone have a numpy implementation? --Bill Baxter |
From: Bill B. <wb...@gm...> - 2006-02-20 06:36:46
|
Upon further inspection I find that if I call 'from scipy import *' then linalg.lu etc are defined. But if I do anything else to import scipy like 'import scipy' or 'import scipy as S' or 'from scipy import linalg', then lu, cg etc are not defined. Why is that? I can get at them without importing * by doing 'from scipy.linalg import lu', but that's kind of odd to have to do that. --bb On 2/20/06, Bill Baxter <wb...@gm...> wrote: > > This url http://www.rexx.com/~dkuhlman/scipy_course_01.html<http://www.re= xx.com/%7Edkuhlman/scipy_course_01.html>seems to keep turning up in my sear= ches for numpy and scipy things, > but many of the linalg operations it lists don't seem to exist in recent > versions of numpy (or scipy). > > Some of them are: > > * norm > * factorizations: lu, lu_factor, lu_solve, qr > * iterative solvers: cg, cgs, gmres etc. > > Did these things used to exist in Numeric but they haven't been ported > over? Will they be re-introduced sometime? > > In the short term, the one I'm after right now is LU decompose and solve > functionality. Anyone have a numpy implementation? > > --Bill Baxter > -- William V. Baxter III OLM Digital Kono Dens Building Rm 302 1-8-8 Wakabayashi Setagaya-ku Tokyo, Japan 154-0023 +81 (3) 3422-3380 |
From: Bill B. <wb...@gm...> - 2006-02-20 06:48:46
|
Ack. I may be able to get references to lu, lu_factor, et al, but they don't actually work with numpy arrays: from scipy.linalg import lu,lu_factor,lu_solve import scipy as S A =3D S.rand(2,2) lu(A) Traceback (most recent call last): File "<input>", line 1, in ? File "C:\Python24\Lib\site-packages\scipy\linalg\decomp.py", line 249, in lu flu, =3D get_flinalg_funcs(('lu',),(a1,)) File "C:\Python24\Lib\site-packages\scipy\linalg\flinalg.py", line 30, in get_flinalg_funcs t =3D arrays[i].dtypechar AttributeError: 'numpy.ndarray' object has no attribute 'dtypechar' Ok, so, once again, does anyone have an lu_factor / lu_solve implementation in python that I could borrow? Apologies for the monologue. --bb On 2/20/06, Bill Baxter <wb...@gm...> wrote: > > Upon further inspection I find that if I call 'from scipy import *' then > linalg.lu etc are defined. > But if I do anything else to import scipy like 'import scipy' or 'import > scipy as S' or 'from scipy import linalg', then lu, cg etc are not define= d. > > > Why is that? > > I can get at them without importing * by doing 'from scipy.linalg import > lu', but that's kind of odd to have to do that. > > --bb > > On 2/20/06, Bill Baxter <wb...@gm...> wrote: > > > > This url http://www.rexx.com/~dkuhlman/scipy_course_01.html<http://www.= rexx.com/%7Edkuhlman/scipy_course_01.html>seems to keep turning up in my se= arches for numpy and scipy things, > > but many of the linalg operations it lists don't seem to exist in recen= t > > versions of numpy (or scipy). > > > > Some of them are: > > > > * norm > > * factorizations: lu, lu_factor, lu_solve, qr > > * iterative solvers: cg, cgs, gmres etc. > > > > Did these things used to exist in Numeric but they haven't been ported > > over? Will they be re-introduced sometime? > > > > In the short term, the one I'm after right now is LU decompose and solv= e > > functionality. Anyone have a numpy implementation? > > > > --Bill Baxter > > > |
From: Bill B. <wb...@gm...> - 2006-02-20 07:37:19
|
Should have mentioned -- I was using numpy 0.9.4 / scipy 0.4.4. Looks like it works in numpy 0.9.5 / scipy 0.4.6 But matplotlib, which I also need, hasn't been updated for numpy 0.9.5 yet. :-( It's also still pretty weird to me that you have to do "from scipy.linalgimport lu" specifically. And then after doing that one import, then all the other scipy.linalg.* functions magically spring into existence too. Is tha= t sort of hing expected behavior from Python imports? >>> import numpy as N >>> import scipy as S >>> S.linalg.lu Traceback (most recent call last): File "<input>", line 1, in ? AttributeError: 'module' object has no attribute 'lu' >>> from scipy.linalg import lu >>> S.linalg.lu(N.rand(2,2)) (array([[ 0., 1.], [ 1., 0.]]), array([[ 1. , 0. ], [ 0.18553085, 1. ]]), array([[ 0.71732168, 0.48540043], [ 0. , 0.61379118]])) >>> (N.__version__, S.__version__) ('0.9.5', '0.4.6') --bb On 2/20/06, Nils Wagner <nw...@me...> wrote: > > Bill Baxter wrote: > > Ack. I may be able to get references to lu, lu_factor, et al, but > > they don't actually work with numpy arrays: > > > > from scipy.linalg import lu,lu_factor,lu_solve > > import scipy as S > > A =3D S.rand(2,2) > > lu(A) > > Traceback (most recent call last): > > File "<input>", line 1, in ? > > File "C:\Python24\Lib\site-packages\scipy\linalg\decomp.py", line > > 249, in lu > > flu, =3D get_flinalg_funcs(('lu',),(a1,)) > > File "C:\Python24\Lib\site-packages\scipy\linalg\flinalg.py", line > > 30, in get_flinalg_funcs > > t =3D arrays[i].dtypechar > > AttributeError: 'numpy.ndarray' object has no attribute 'dtypechar' > > > > > > Ok, so, once again, does anyone have an lu_factor / lu_solve > > implementation in python that I could borrow? > > > > Apologies for the monologue. > > > > --bb > > > > > > On 2/20/06, *Bill Baxter* <wb...@gm... > > <mailto:wb...@gm...>> wrote: > > > > Upon further inspection I find that if I call 'from scipy import > > *' then linalg.lu <http://linalg.lu> etc are defined. > > But if I do anything else to import scipy like 'import scipy' or > > 'import scipy as S' or 'from scipy import linalg', then lu, cg etc > > are not defined. > > > > Why is that? > > > > I can get at them without importing * by doing 'from scipy.linalg > > import lu', but that's kind of odd to have to do that. > > > > --bb > > > > > > On 2/20/06, * Bill Baxter* <wb...@gm... > > <mailto:wb...@gm...>> wrote: > > > > This url http://www.rexx.com/~dkuhlman/scipy_course_01.html > > <http://www.rexx.com/%7Edkuhlman/scipy_course_01.html> seems > > to keep turning up in my searches for numpy and scipy things, > > but many of the linalg operations it lists don't seem to exist > > in recent versions of numpy (or scipy). > > > > Some of them are: > > > > * norm > > * factorizations: lu, lu_factor, lu_solve, qr > > * iterative solvers: cg, cgs, gmres etc. > > > > Did these things used to exist in Numeric but they haven't > > been ported over? Will they be re-introduced sometime? > > > > In the short term, the one I'm after right now is LU decompose > > and solve functionality. Anyone have a numpy implementation? > > > > --Bill Baxter > > > No problem here. > > >>> from scipy.linalg import lu,lu_factor,lu_solve > >>> import scipy as S > >>> A =3D S.rand(2,2) > >>> lu(A) > (array([[ 0., 1.], > [ 1., 0.]]), array([[ 1. , 0. ], > [ 0.81367315, 1. ]]), array([[ 0.49886054, 0.57065709], > [ 0. , -0.30862809]])) > >>> S.__version__ > '0.4.7.1614' > > > Nils > > |
From: Bill B. <wb...@gm...> - 2006-02-21 01:48:18
|
On 2/20/06, Bill Baxter <wb...@gm...> wrote: > > Should have mentioned -- I was using numpy 0.9.4 / scipy 0.4.4. > > Looks like it works in numpy 0.9.5 / scipy 0.4.6 > > > > But matplotlib, which I also need, hasn't been updated for numpy 0.9.5y= et. > > :-( > > > > On 2/21/06, Jonathan Taylor wrote: > > For matplotlib, I just use tolist() like > > a =3D array([1,3,2,3]) > > ... > > pylab.plot(a.tolist()) > > Maybe that will work for you until you can fix your problem. > J. Excellent idea! That does the trick for now (if I take the numerix: numpy line out of my .matplotlibrc to stop it from crashing on import). --bb |