> Is there a simple way to calculate rank using this method?  My J-only
> solutions all involve something like reduced row echelon form, using the
> script libraries.  I suspect the interpreter does a better job.

Since "a simple way" covers a lot of ground, and does not
explicitly exclude computationally profligate ways, I offer 
the following:

   lii=: 1:@%. :: 0:

   x=: (<a:;0 1 2 3 0 1){10 4 [EMAIL PROTECTED] 0
   $x
10 6

   >./ +/"1 x (lii@(#"1~"_ 1) # ]) #:i.2^{:$ x
4

The last expression computes the "rank" of x, the
number of linearly independent columns in x .

I believe the subroutines used in the implementation
of %. , viz. the QR decomposition, can be used to 
compute the rank, but I have to think about whether
there is a way using only the J primitives to extract
that information.  You can use the code in the QR 
or LU essays to play around with the idea.

http://www.jsoftware.com/jwiki/Essays/QR_Decomposition
http://www.jsoftware.com/jwiki/Essays/LU_Decomposition



----- Original Message -----
From: John Randall <[EMAIL PROTECTED]>
Date: Friday, September 7, 2007 14:31
Subject: Re: [Jgeneral] linear independence?
To: General forum <[email protected]>

> Roger Hui wrote:
> > The methods I suggested work for square and non-square
> > (tall, not wide) matrices.
> >
> >    lii=: 1:@%. ::0:
> 
> Fair enough.  I had forgotten that monadic %. works for non-
> squarematrices, although I am familiar with its dyadic use.
> 
> Is there a simple way to calculate rank using this method?  
> My J-only
> solutions all involve something like reduced row echelon form, 
> using the
> script libraries.  I suspect the interpreter does a better job.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to