
What about dumping the matrix into a C array using the storable instance
of the linear package's matrices, and then use a foreign-imported svd call
from lapack? I don't know whether you can count on lapack being available
in your systems. The lapack call is very clumsy, requiring lots of pointer
inputs, but it should be doable in a few lines of code.
The rank is then the number of nonzero singular values, for some
accuracy-dependent definition of "nonzero".
På Fri, 24 Apr 2015 15:30:23 +0200, skrev Mike Meyer
The bed-and-breakfast isn't to bad, except for needing TH. But it's apparently not being maintained. I've started the process of >replacing the maintainer, but may roll my own instead.
Thanks, Mike
On Fri, Apr 24, 2015 at 8:27 AM, Dennis J. McWherter, Jr.
wrote: I am not aware of any small library which does just this, but you could easily roll your own. Though not the most efficient >>method, implementing gaussian elimination is a straightforward task (you can even find the backtracking algorithm on google) and >>then you can find the rank from there.
Dennis
On Fri, Apr 24, 2015 at 6:50 AM, Mike Meyer
wrote: My apologies,but my use of "low-cost" was ambiguous.
calculation to be fast, or even cheap to compute, as it's not used very often, and not for very large matrices. I'd rather not >>>have
I meant the cost of having it available - installation, size of the package, extra packages brought in, etc. I don't the rank the size of the software multiplied by integers in order to get that one function.
hmatrix is highly optimized for performance and parallelization, built on top of a large C libraries with lots of >>>functionality. Nice to have if you're doing any serious work with matrices, but massive overkill for what I need.
On Fri, Apr 24, 2015 at 3:13 AM, Alberto Ruiz
wrote: Hi Mike,
If you need a robust numerical computation you can try "rcond" or "rank" from hmatrix. (It is based on the singular values, >>>>I don't know if the cost is low enough for your application.)
http://en.wikipedia.org/wiki/Rank_%28linear_algebra%29#Computation
https://hackage.haskell.org/package/hmatrix-0.16.1.5/docs/Numeric-LinearAlge...
Alberto
On 24/04/15 00:34, Mike Meyer wrote:
Noticing that diagrams 1.3 has moved from vector-space to linear, I decided to check them both for a function to compute the rank of a matrix. Neither seems to have it.
While I'm doing quite a bit of work with 2 and 3-element vectors, the only thing I do with matrices is take their rank, as part of verifying that the faces of a polyhedron actually make a polyhedron.
So I'm looking for a relatively light-weight way of doing so that will work with a recent (7.8 or 7.10) ghc release. Or maybe getting such a function added to an existing library. Anyone have any suggestions?
Thanks, Mike
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Audun Skaugen