Re: [Bug-apl] tensor product

2016-01-24 Thread Tobia C.
It seems I replied to a year-old thread. Anyways, I refined your lambda into this: tensor←{,[1 2]{,[3 4]1 3 2 4⍉⍵}⍣(1<⍴⍴⍵)(⍺∘.×⍵)} which computes the tensor product for both vectors and matrices and is quite readable. Thanks, Tobia On Sun, Jan 24, 2016 at 10:21 PM, Louis de Forcrand wrote: >

Re: [Bug-apl] tensor product

2016-01-24 Thread Louis de Forcrand
I have no idea what you’re actually trying to do, but this (inelegant) lambda works: tensor←{ ,[1 2] { { ,[3 4] 1 3 2 4 ⍉ ⍵} ⍣ (2 < ⍴⍴⍵) ⍵ } ⍺ ∘.× ⍵} Basically, it conditionally executes the transpose and first ravel if the result of the outer product is of rank greater than 2. If you d

Re: [Bug-apl] tensor product

2015-05-20 Thread Fausto Saporito
Foad > Date: 20 May 2015 at 14:55 > Subject: Re: [Bug-apl] tensor product > To: Fausto Saporito > > > "Why" does it give a multidimensional result? Because that's the way > it's defined in APL. APL has generalised outer product in a way that > works v

Re: [Bug-apl] tensor product

2015-05-20 Thread Elias Mårtenson
Wouldn't that be because ∘.× is not the tensor product operation? The result of the ∘.OP function with arguments of rank n and m will always yield a matrix of rank n×m. I'd rather refer to the ∘. operator as the cartesian operator since it applies its function on all possible permutations of the i