Matlab has a built-in function for calculating rank of a matrix with decimal numbers as well as finite field numbers. However if I am not wrong they calculate only the lowest rank (least of row rank and column rank). I would like to calculate only the row rank, i.e. find the number of independent rows of a matrix (finite field in my case). Is there a function or way to do this?
相关问题
- Extract matrix elements using a vector of column i
- Reshape matrix by rows
- Non-Conformable Arrays when Doing Matrix Multiplic
- How do you get R's null and residual deviance
- How to display an image represented by three matri
相关文章
- Numpy matrix of coordinates
- How do I append metadata to an image in Matlab?
- C++: How to use unnamed template parameters in cla
- How to compute the power of a matrix in R [duplica
- How can I write-protect the Matlab language?
- Create n by n matrix with unique values from 1:n
- `std::sin` is wrong in the last bit
- How do I extract rownames from a matrix?
Schwartz,
Two comments:
You state in a comment "The rank function works just fine in Galois fields as well!" I don't think this is correct. Consider the example given on the documentation page for
gfrank
:But it is possible I am misunderstanding things!
You also said "How to check if the rows of a matrix are linearly independent? Does the solution I posted above seem legit to you i.e. taking each row and finding its rank with all the other rows one by one?"
I don't know why you say "find its rank with all the other rows one by one". It is possible to have a set of vectors which are pairwise linearly independent, yet linearly dependent taken as a group. Just consider the vectors
[0 1]
,[1 0]
,[1 1]
. No vector is a multiple of any other, yet the set is not linearly independent.Your problem appears to be that you have a set of vector that you know are linearly independent. You add a vector to that set, and want to know whether the new set is still linearly independent. As @EitanT said, all you need to do is combine the (row) vectors into a matrix and check whether its
rank
(orgfrank
) is equal to the number of rows. No need to do anything "one-by-one".Since you know that the "old" set is linearly independent, perhaps there is a nice fast algorithm to check whether the new vector makes thing linearly dependent. Maybe at each step you orthogonalize the set, and perhaps that would make the process of checking for linear independence given the new vector faster. That might make an interesting question somewhere like mathoverflow.
In linear algebra the column rank and the row rank are always equal (see proof), so just use
rank
(if you're computing the the rank of a matrix over Galois fields, consider using
gfrank
instead, like @DanBecker suggested in his comment):Example:
Perhaps all three columns seem to be linearly independent, but they are dependent:
meaning that
-1 * [1; 4] + 2 * [2; 5] = [3; 6]