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 inputs.

Regards,
Elias

On 20 May 2015 at 21:31, Fausto Saporito <[email protected]> wrote:

> Hello all,
>
> I don't understand why the tensor product in APL (∘.×) between two
> matrices, gives a multidimensional array as result.
>
> From linear algebra, tensor product (or kronecker product) gives a
> matrix as result,
>
> for example
>
> if I2 is identity matrix
>
> 1 0
> 0 1
>
> I2 (tensor product) I2 gives
>
> 1 0 0 0
> 0 1 0 0
> 0 0 1 0
> 0 0 0 1
>
> instead if I use the APL operator I have :
>
> 1 0
> 0 1
>
> 0 0
> 0 0
>
>
> 0 0
> 0 0
>
> 1 0
> 0 1
>
> the result is correct but why the shape is different ?
>
> Is there a way to have a behaviour similar to linear algebra result ?
>
> I wrote a generic tensor product function, but I'm not happy because
> it uses loops and I don't like APL with loops :) but I didn't figure
> out a loopless solution.
>
> thanks,
> Fausto
>
>

Reply via email to