Roger Hui wrote:
> To work with rows rather than columns, transpose
> the matrix, and then:
>
> Method 0: the columns are linearly independent if
> the matrix is invertible.
>
> lii=: 1:@%. ::0:
>
> Method 1: the columns are linearly independent
> if the determinant is non-zero:
>
> lid=: 0: ~: [: -/ .* (|: +/ .* ])^:(>/@$)

I agree that this is the best way to go with square matrices.  The rref
method I suggested (which mimics pencil and paper methods) is a good start
for nonsquare matrices.  It can probably done better than my suggested
code.

However, the question of finding the rank of a matrix is difficult
numerically.  The method usually suggested is singular value
decomposition, but there has been a lot of work on methods for special
matrices. See, for example

<http://www.neiu.edu/~zzeng/Papers/rankrev.pdf>

Best wishes,

John

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to