<!DOCTYPE html><html><head>
<style type="text/css">body { font-family:'DejaVu Sans Mono'; font-size:12px}</style>

<style type="text/css">body { font-family:'DejaVu Sans Mono'; font-size:12px}</style>
</head>
<body><div>I found it a fun challenge, so I coded up a small demonstration in the attached file :)</div><div><br></div><div>På Fri, 24 Apr 2015 16:01:24 +0200, skrev Audun Skaugen <audunskaugen@gmail.com>:<br></div><br><blockquote style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 1ex"><div>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.</div><div><br></div><div>The rank is then the number of nonzero singular values, for some accuracy-dependent definition of "nonzero".</div><div><br></div><div>På Fri, 24 Apr 2015 15:30:23 +0200, skrev Mike Meyer <mwm@mired.org>:<br></div><br><blockquote style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 1ex"><div dir="ltr">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.<div><br></div><div>Thanks,</div><div>Mike</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 24, 2015 at 8:27 AM, Dennis J. McWherter, Jr. <span dir="ltr"><<a href="mailto:dennis@deathbytape.com" target="_blank">dennis@deathbytape.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.<div><br></div><div>Dennis</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 24, 2015 at 6:50 AM, Mike Meyer <span dir="ltr"><<a href="mailto:mwm@mired.org" target="_blank">mwm@mired.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">My apologies,but my use of "low-cost" was ambiguous.<div><br></div><div>I meant the cost of having it available - installation, size of the package, extra packages brought in, etc. I don't the rank 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 the size of the software multiplied by integers in order to get that one function.</div><div><br></div><div>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.</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 24, 2015 at 3:13 AM, Alberto Ruiz <span dir="ltr"><<a href="mailto:aruiz@um.es" target="_blank">aruiz@um.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mike,<br>
<br>
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.)<br>
<br>
<a href="http://en.wikipedia.org/wiki/Rank_%28linear_algebra%29#Computation" target="_blank">http://en.wikipedia.org/wiki/Rank_%28linear_algebra%29#Computation</a><br>
<br>
<a href="https://hackage.haskell.org/package/hmatrix-0.16.1.5/docs/Numeric-LinearAlgebra-HMatrix.html#g:10" target="_blank">https://hackage.haskell.org/package/hmatrix-0.16.1.5/docs/Numeric-LinearAlgebra-HMatrix.html#g:10</a><br>
<br>
Alberto<br>
<br>
On 24/04/15 00:34, Mike Meyer wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Noticing that diagrams 1.3 has moved from vector-space to linear, I<br>
decided to check them both for a function to compute the rank of a<br>
matrix. Neither seems to have it.<br>
<br>
While I'm doing quite a bit of work with 2 and 3-element vectors, the<br>
only thing I do with matrices is take their rank, as part of verifying<br>
that the faces of a polyhedron actually make a polyhedron.<br>
<br>
So I'm looking for a relatively light-weight way of doing so that will<br>
work with a recent (7.8 or 7.10) ghc release. Or maybe getting such a<br>
function added to an existing library. Anyone have any suggestions?<br>
<br>
Thanks,<br>
Mike<br>
</blockquote>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</blockquote><br><br><br><div id="M2Signature"><div>-- </div><div>Audun Skaugen</div></div></blockquote><br><br><br><div id="M2Signature"><div>-- </div><div>Audun Skaugen</div></div></body></html>