mikera / core.matrix

core.matrix : Multi-dimensional array programming API for Clojure
Other
701 stars 113 forks source link

svd: mismatch between docstring and return value #321

Open mars0i opened 7 years ago

mars0i commented 7 years ago

The docstring for svd says that the value of key :S is "a diagonal matrix whose elements are the singular values of the original matrix", but what's returned is a vector, apparently containing the singular values. This is true for vectorz, which returns a vectorz vector, and for clatrix, which returns a clojure.lang.ArraySeq$ArraySeq_double.

My guess is that it's the docstring that should be changed, rather than the function; I have the impression that folks often want only the singular values (although for calculating a Moore-Penrose inverse, it's the matrix that you need, though it's just as efficient or more to construct from scratch).

mikera commented 7 years ago

Good catch. Yes I think it is best if we just change the docstring. Not much value in constructing a full diagonal matrix if you only need the singular values.

mars0i commented 7 years ago

Submitted a PR. There's an error from VersionEye "Some dependencies have no license." Looks like this has something to do with hiccup. I don't know anything about this, but please let me know if it would be helpful for me to resubmit. Thanks again.