[SciPy-dev] ValueError: frames are not aligned

Nils Wagner wagner.nils at vdi.de
Sat Nov 2 15:24:01 CST 2002


Hi,

I tried to compute the pseudo-inverse of a random matrix...

>>> scipy.__version__
'0.2.0_alpha_145.4411'

>>> from scipy import *
>>> a = rand(5,3)
>>> a
array([[ 0.81884205,  0.3865217 ,  0.9218021 ],
       [ 0.99365133,  0.36057177,  0.64316332],
       [ 0.00589046,  0.56506401,  0.97917145],
       [ 0.43969154,  0.44840959,  0.26978564],
       [ 0.11854674,  0.56671292,  0.8699165 ]])
>>> ap = linalg.pinv2(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/site-packages/scipy/linalg/basic.py", line 327, in pi                                      nv2
    return dot(tran(conj(vh)),tran(conj(u))*s[:,NewAxis])
ValueError: frames are not aligned

What is the reason for that ?

However, pinv worls fine

>>> ap = linalg.pinv(a)
>>> ap
array([[ 0.34069276,  0.65084773, -0.51301133,  0.26982581, -0.34844927],
       [-1.32339071, -0.14174113,  0.06124646,  2.61495834,  0.62720737],
       [ 0.88231874, -0.0535125 ,  0.55819992, -1.55919289,  0.10939951]])
>>> dot(ap,a)
array([[  1.00000000e+00,  -6.69765892e-17,   1.14030963e-16],
       [  7.31768704e-17,   1.00000000e+00,  -2.01878445e-16],
       [ -2.80238310e-16,  -1.01511817e-16,   1.00000000e+00]])
>>>
Nils




More information about the Scipy-dev mailing list