Reputation: 51
I've been trying to solve whether two m-by-n matrices A and B are equivalent via
[a,ja] = rref(A,tol)
[b,jb] = rref(B,tol)
and then comparing
isequal(a,b) & isequal(ja,jb)
First, I don't really understand what ja
and jb
are. My problem is that the reduced row echelon form is very simple for both A and B and identical in all cases. I don't know whether this is on purpose or not. For example, I get equivalence for just
A = rand(40,3)
B = rand(40,3)
which I'm not sure is nonsense or not.
Upvotes: 0
Views: 820
Reputation: 18484
It looks like you're trying to check if the reduced row echelon forms of two matrices are element-wise equivalent. From how you've defined A
and B
, they are (it's effectively an overdetermined system, I believe). However, I think that you may have flipped your rows and columns. If instead you create A
and B
such that there are more columns than rows (i.e., an augmented matrix of an underdetermined system):
A = rand(3,40)
B = rand(3,40)
then when you run rref
, you'll see a much different output and your comparison will return false as you perhaps expected.
Also, I think that it is sufficient to use the following, as two matrices that are equal element-wise will surely share the same rank (or approximation thereof):
a = rref(A,tol);
b = rref(B,tol);
isequal(a,b)
Upvotes: 1