ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 24 May 2018 21:15:49 +0200Rank of float matrixhttps://ask.sagemath.org/question/42405/rank-of-float-matrix/I want to compute the "numerical" rank of 9*18 FLOAT matrix A_float that i know is a good approximation of a REAL matrix A_real.
Is there any method to do that ?
More precisely, i want to know if A_real is of rank at most 8, so i compute all the minors of A_float which happen to be all less (in absolute value) than 10^-32, so i conclude that A_real has good chance to be of rank at most 8.
Is there is any method better than computing the 3 000 000 9*9 minors of A_float (which takes a few minutes) but i want to run this computation over a few thousand of differents A_float.Wed, 23 May 2018 14:05:02 +0200https://ask.sagemath.org/question/42405/rank-of-float-matrix/Comment by dan_fulea for <p>I want to compute the "numerical" rank of 9*18 FLOAT matrix A_float that i know is a good approximation of a REAL matrix A_real.</p>
<p>Is there any method to do that ?</p>
<p>More precisely, i want to know if A_real is of rank at most 8, so i compute all the minors of A_float which happen to be all less (in absolute value) than 10^-32, so i conclude that A_real has good chance to be of rank at most 8.</p>
<p>Is there is any method better than computing the 3 000 000 9*9 minors of A_float (which takes a few minutes) but i want to run this computation over a few thousand of differents A_float.</p>
https://ask.sagemath.org/question/42405/rank-of-float-matrix/?comment=42410#post-id-42410Use for instance Gauss elimination, the choice of the pivots (at each step they should have maximal absolute value, for instance) is major to avoid numerical difficulties when minors are "near zero". Sage and many other programs already do the job in a good manner.Wed, 23 May 2018 18:10:21 +0200https://ask.sagemath.org/question/42405/rank-of-float-matrix/?comment=42410#post-id-42410Comment by vdelecroix for <p>I want to compute the "numerical" rank of 9*18 FLOAT matrix A_float that i know is a good approximation of a REAL matrix A_real.</p>
<p>Is there any method to do that ?</p>
<p>More precisely, i want to know if A_real is of rank at most 8, so i compute all the minors of A_float which happen to be all less (in absolute value) than 10^-32, so i conclude that A_real has good chance to be of rank at most 8.</p>
<p>Is there is any method better than computing the 3 000 000 9*9 minors of A_float (which takes a few minutes) but i want to run this computation over a few thousand of differents A_float.</p>
https://ask.sagemath.org/question/42405/rank-of-float-matrix/?comment=42412#post-id-42412quite similar to https://ask.sagemath.org/question/41456/cant-find-matrix-kernel/Wed, 23 May 2018 23:21:49 +0200https://ask.sagemath.org/question/42405/rank-of-float-matrix/?comment=42412#post-id-42412Comment by nbruin for <p>I want to compute the "numerical" rank of 9*18 FLOAT matrix A_float that i know is a good approximation of a REAL matrix A_real.</p>
<p>Is there any method to do that ?</p>
<p>More precisely, i want to know if A_real is of rank at most 8, so i compute all the minors of A_float which happen to be all less (in absolute value) than 10^-32, so i conclude that A_real has good chance to be of rank at most 8.</p>
<p>Is there is any method better than computing the 3 000 000 9*9 minors of A_float (which takes a few minutes) but i want to run this computation over a few thousand of differents A_float.</p>
https://ask.sagemath.org/question/42405/rank-of-float-matrix/?comment=42411#post-id-42411@dan_fuela: no, it does NOT by default. You'll have to go dig for an LU decomposition routine. Floating point linear algebra, even with matrices that are a "good" approximations, is tricky. Depending on what you want to do, a QR decomposition may be better.Wed, 23 May 2018 18:19:03 +0200https://ask.sagemath.org/question/42405/rank-of-float-matrix/?comment=42411#post-id-42411Comment by Ludo for <p>I want to compute the "numerical" rank of 9*18 FLOAT matrix A_float that i know is a good approximation of a REAL matrix A_real.</p>
<p>Is there any method to do that ?</p>
<p>More precisely, i want to know if A_real is of rank at most 8, so i compute all the minors of A_float which happen to be all less (in absolute value) than 10^-32, so i conclude that A_real has good chance to be of rank at most 8.</p>
<p>Is there is any method better than computing the 3 000 000 9*9 minors of A_float (which takes a few minutes) but i want to run this computation over a few thousand of differents A_float.</p>
https://ask.sagemath.org/question/42405/rank-of-float-matrix/?comment=42426#post-id-42426@nbruin: I just want to compute dimension of the kernel, i don't want to compute the equation of the kernel. I haven't try the QR tech. I've try the following. I ask Sage to compute the singular value of A_float by asking Sage to compute the eigenvalue of the matrix A.transpose()*A.
I've declare that a float less than 10^-10 is zero, and a float bigger than 0.01 is really no zero. And so,i can compute the rank by counting the eigenvalue which are bigger than 0.01.
In practice, it work well. But, i wonder if Sage can't compute the singular value in a more efficient way. I've find than if my numbers where in RDF then just A_float.SVD() would do the job, but my float are in RR with 212 bits of precision, so i don't know if i should (and how) convert them to RDF an use the SVD implement in SagThu, 24 May 2018 21:15:49 +0200https://ask.sagemath.org/question/42405/rank-of-float-matrix/?comment=42426#post-id-42426