So,
NB. polynomial product
    pp =: +//.@:(*/)"1
NB. polynomial determinant: y is square rank-3 matrix of polynomials
    pdet =: ([: , ({."2   -/ . pp   $:@(1&(}."2\.)))^:(1<#))"3
NB. (negative of) characteristic polynomial of square matrix
    cpoly =: [: pdet (,"0 -@e.@i.@#)
NB. eigenvalues of square matrix
    ev =: 1 {:: p.@cpoly

This is going to run in time O(!n), in other words, small matrices only.

(It's barely faster than the boxed version and takes a little less 
space, but neither version takes much space)

Henry Rich

On 6/10/2012 11:26 PM, Marshall Lochbaum wrote:
> It looks like the determinant conjunction . gives functions that are
> explicitly rank 2:
>     -/ .* b. 0
> 2 _ _
> This means we can't use a matrix of rank-1 polynomials as input without
> redefining the conjunction ourselves.
>
> Marshall
>
> On Sun, Jun 10, 2012 at 10:05 PM, Raul Miller<rauldmil...@gmail.com>  wrote:
>
>> I am looking for a concise expression to find eigenvalues in J (for
>> small matrices)
>>
>> lapack is not universally available, so I am ignoring it.
>>
>> Here's the best I have been able to find (loosely based on an "At Play
>> With J" article)
>>
>> ev=: 1 {:: [: p.@>  [: -&.>/ .(+//.@(*/)&.>) ]<@,"0 -@=@i.@#
>>
>> Is there some way to eliminate the boxing and unboxing here?
>>
>> Thanks,
>>
>> --
>> Raul
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to