La forma más rápida de comprobar si un vector aumenta el rango de la matriz

Given an n-by-m matrix A, with it being guaranteed that n>m=rank(A), and given a n-by-1 column v, what is the fastest way to check if [A v] has rank strictly bigger than A?

For my application, A is sparse, n is about 2^12, and m is anywhere in 1:n-1. Comparing rank(full([A v])) takes about a second on my machine, and I need to do it tens of thousands of times, so I would be very happy to discover a quicker way.

preguntado el 01 de febrero de 12 a las 14:02

You say you need to do this 10k times. What changes from run to run? E.g. is A always the same and you check against many vectors v? O son A y la v different for every run? -

@FlorianBrucker I start with A having relatively few columns, and then I have a loop that runs ~20K times, each time generating a new v in some specific way, checking to see if it linearly independent of the column space of A, and if it is, appending it to A. -

The fastest solution may be to use the null-space as a constraint for creating new vectors v. -

@Jonas - Yes, if the goal is to pick new vectors that lie entirely in the null space, then the logical solution is to only pick vectors that are linear combinations of the nullspace basis vectors. -

3 Respuestas

There is no need to do repeated solves IF you can afford to do ONE computation of the null space. Just one call to null will suffice. Given a new vector V, if the dot product with V and the nullspace basis is non-zero, then V will increase the rank of the matrix. For example, suppose we have the matrix M, which of course has a rank of 2.

M = [1 1;2 2;3 1;4 2];
nullM = null(M')';

Will a new column vector [1;1;1;1] increase the rank if we appended it to M?

nullM*[1;1;1;1]
ans =
       -0.0321573705742971
        -0.602164651199413

Yes, since it has a non-zero projection on at least one of the basis vectors in nullM.

How about this vector:

nullM*[0;0;1;1]
ans =
      1.11022302462516e-16
      2.22044604925031e-16

In this case, both numbers are essentially zero, so the vector in question would not have increased the rank of M.

The point is, only a simple matrix-vector multiplication is necessary once the null space basis has been generated. If your matrix is too large (and the matrix nearly of full rank) that a call to null will fail here, then you will need to do more work. However, n = 4096 is not excessively large as long as the matrix does not have too many columns.

One alternative if null is too much is a call to svds, to find those singular vectors that are essentially zero. These will form the nullspace basis that we need.

Respondido 01 Feb 12, 20:02

Thanks! That's what I attempted, except that my LinAlg-fu is not as strong as yours. - Jonas

yo usaría sprank for sparse matrixes. Check it out, it might be faster than any other method.

Editar : As pointed out correctly by @IanHincks, it is not the rank. I am leaving the answer here, just in case someone else will need it in the future.

Respondido 01 Feb 12, 20:02

It's definitely much faster, but it does not return the rank, only a bound on the rank (the documentation calls it the structural rank). - Ian Hincks

Maybe you can try to solve the system A*x=v, if it has a solution that means that the rank does not increase.

x=(B\A)';
norm(A*x-B) %% if this is small then the rank does not increase

Respondido 01 Feb 12, 19:02

Good suggestion, but it appears to be a bit more time intensive than calling rank([full(A) v]) with my test cases -- about 4 seconds compared to 1 second. - Ian Hincks

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.