And ] .] also has rank 2...

But looking at http://www.jsoftware.com/help/dictionary/d300.htm when
I try to replace . with DET, I get a length error.  DET works fine for
numbers.

Looking closer, the problem seems to be with how soon DET terminates.

-/ .* performs only one multiply.

-/ DET* performs a lot of extra multiplies (I think 4 multiplies, but
they are hard to count directly because DET does not work if * is
replaced with a verb with rank greater than 0).

But, also, DET uses $: which can make its use in tacit expressions problematic.

So... I replaced DET with this definition, and it seemed to work:

DET=: 2 : '(f=:{.@,`({."1 u . v f@minors)@.(1<{:@$) @ ,. "2) f.'

Of course, this is not very general -- I can only have one functioning
DET definition active -- but it's good enough for a model.

So, then I modified minors and DET to be like this:

  DET=: 2 : 'f=: {.@{.`({."_1 u . v f@minors)@.(1<1{$) "(2+ {. v b. 0)'
  minors=: }."_2 @ (1&([\.))

And, I defined my eigenvalue function in terms of DET:

  ev=: 1 {:: [: p. [: -/ DET(+//.@(*/)"1) ] ,"0 -@=@i.@#

and this worked!

But this loses the ,. functionality of the original, which would turn
a vector into a column.

In other words -/ .* i. 5  is -/ .* i. 5 1 and not -/ .* i.1 5

So, if we redefined . to be this DET it would be completely compatible
for matrix arguments but not so compatible for vector arguments.  So..
what would an equivalent to ,. look like for a sequence of
polynomials?  And, can anyone think of a useful example of this
mechanism where the product part consumes rank 2 items?

Thanks,

-- 
Raul


On Sun, Jun 10, 2012 at 11:26 PM, Marshall Lochbaum
<mwlochb...@gmail.com> 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