[Numpy-discussion] SVD problem - matrices are not aligned
Charles R Harris
Sat Oct 23 21:48:43 CDT 2010
On Sat, Oct 23, 2010 at 8:33 PM, Daniel Wagner <daniel.wagner.ml@
> On Sat, Oct 23, 2010 at 7:00 PM, Daniel Wagner <daniel.wagner.ml@
> googlemail.com> wrote:
>> I'm a new subscriber of this list. I hope to directly start with a
>> question is ok...
>> My question or problem:
>> I've a matrix A which is calculated from the data b. The shapes of these
>> matrices are:
>> (954, 9)
>> I calculate the SVD of A:
>> >>> U, w, V = numpy.linalg.svd(A, full_matrices="True")
>> (954, 954)
> You want full_matrices set false so that U has shape (954, 9).
> thanks! I tried it before with "False" as a string but of course this
> couldn't work. omgh. (no error message?)
> Now I'm using:
> >>>U, w, V = numpy.linalg.svd(yz_matrix_by, full_matrices=False)
>> If I'm doing the check of the SVD results using:
>> >>>numpy.allclose(A, numpy.dot(U, numpy.dot(W, V)))
>> I get this error:
> easier, allclose(A, dot(U*w, V) )
> That's right!
> "ValueError: matrices are not aligned"
> Mismatched dimensions.
> Yeah, this error is away. Now I get:
> >>>print(numpy.allclose(U_by*w_by, V_by))
Seems to be a missing "dot" in there.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion