This is a space-time performance comparison:
block=: 1 : '[:,/[:,./"3 u'
kp3=. */ block
st=. (] , <@:(1&({::) * 2&({::)))@:(] ; 7!:2@:] ; 6!:2)
100 st &> 'A kp0 B' ; 'A kp1 B' ; 'A kp2 B' ; 'A kp3 B'
┌───────┬────┬─────────────┬────────────┐
│A kp0 B│3456│1.30442109e_5│0.045080793 │
├───────┼────┼─────────────┼────────────┤
│A kp1 B│3392│1.29415788e_5│0.0438978354│
├───────┼────┼─────────────┼────────────┤
│A kp2 B│3392│1.30905609e_5│0.0444031827│
├───────┼────┼─────────────┼────────────┤
│A kp3 B│3456│1.2905161e_5 │0.0446002363│
└───────┴────┴─────────────┴────────────┘
They very are similar.
On Tue, Apr 29, 2014 at 4:40 PM, Jose Mario Quintana <
[email protected]> wrote:
> That is also my understanding. A couple of alternatives are:
>
> kp1=: *&$ ($,) 0 2 1 3 |: */
> kp2=. ,/"2@:(,/@:(1 3&|:@:(*/)))
>
> A=. i.3 4
> B=. >:*: i. 5 2
>
> A;B
> ┌─────────┬─────┐
> │0 1 2 3│ 1 2│
> │4 5 6 7│ 5 10│
> │8 9 10 11│17 26│
> │ │37 50│
> │ │65 82│
> └─────────┴─────┘
> A kp1 B
> 0 0 1 2 2 4 3 6
> 0 0 5 10 10 20 15 30
> 0 0 17 26 34 52 51 78
> 0 0 37 50 74 100 111 150
> 0 0 65 82 130 164 195 246
> 4 8 5 10 6 12 7 14
> 20 40 25 50 30 60 35 70
> 68 104 85 130 102 156 119 182
> 148 200 185 250 222 300 259 350
> 260 328 325 410 390 492 455 574
> 8 16 9 18 10 20 11 22
> 40 80 45 90 50 100 55 110
> 136 208 153 234 170 260 187 286
> 296 400 333 450 370 500 407 550
> 520 656 585 738 650 820 715 902
> A kp2 B
> 0 0 1 2 2 4 3 6
> 0 0 5 10 10 20 15 30
> 0 0 17 26 34 52 51 78
> 0 0 37 50 74 100 111 150
> 0 0 65 82 130 164 195 246
> 4 8 5 10 6 12 7 14
> 20 40 25 50 30 60 35 70
> 68 104 85 130 102 156 119 182
> 148 200 185 250 222 300 259 350
> 260 328 325 410 390 492 455 574
> 8 16 9 18 10 20 11 22
> 40 80 45 90 50 100 55 110
> 136 208 153 234 170 260 187 286
> 296 400 333 450 370 500 407 550
> 520 656 585 738 650 820 715 902
> kp0=. [: ,/ [: ,./"3 */
> A kp0 B
> 0 0 1 2 2 4 3 6
> 0 0 5 10 10 20 15 30
> 0 0 17 26 34 52 51 78
> 0 0 37 50 74 100 111 150
> 0 0 65 82 130 164 195 246
> 4 8 5 10 6 12 7 14
> 20 40 25 50 30 60 35 70
> 68 104 85 130 102 156 119 182
> 148 200 185 250 222 300 259 350
> 260 328 325 410 390 492 455 574
> 8 16 9 18 10 20 11 22
> 40 80 45 90 50 100 55 110
> 136 208 153 234 170 260 187 286
> 296 400 333 450 370 500 407 550
> 520 656 585 738 650 820 715 902
>
>
> On Tue, Apr 29, 2014 at 4:32 PM, Raul Miller <[email protected]>wrote:
>
>> If I understand properly:
>>
>> Hadamard product is *
>>
>> Kroneker product is ([:,/[:,./"3*/)
>>
>> Or,
>>
>> block=: 1 : '[:,/[:,./"3 u'
>> */ block
>>
>> There are of course other ways of defining this.
>>
>> Khatri-Rao product is A */block &.> B and works on a matrix of boxed
>> matrices
>>
>> Tracy-Sigh product is (1 0 3 |: */)block&.>/block and also works on a
>> matrix of boxed matrices
>>
>> Vector cross product gets interesting because it is typically defined on 3
>> element vectors and there are at least two very distinct ways of
>> generalizing that to vectors of other lengths.
>>
>> Anyways, the paper sounds interesting, and I'd like a copy if it's not too
>> much trouble.
>>
>> Thanks,
>>
>> --
>> Raul
>>
>> On Tue, Apr 29, 2014 at 3:17 PM, mikel paternain <[email protected]
>> >wrote:
>>
>> > In a excellet review paper (see below [1]) Shuangzhe Liu & Götz Trenkler
>> > show some results on matrix products:
>> >
>> > - Hadamard product
>> > - Kroneker product
>> > - Khatri-Rao product
>> > - Tracy-Sigh product
>> > - Khatri-Rao sum
>> > - Tracy-Sigh sum
>> > - Vector cross productSchur complement, etc.
>> >
>> > With this thread, we intend to create a collaborative work to find the
>> > J-expressions that meet these products and sums.
>> > If you want to collaborate, these will be published in next issue of
>> > Journal of J (deadline May-31)
>> > Thanks in advance,
>> > Mikel
>> > JoJ
>> >
>> >
>> -----------------------------------------------------------------------------------------------------------------
>> > [1] There is a free version on the webif you can not find it, we can
>> send
>> > you a copy
>> >
>> > HADAMARD, KHATRI-RAO, KRONECKER AND OTHER MATRIX PRODUCTS
>> > Shuangzhe Liu & Götz Trenkler
>> > International Journal of Infornation ans Systems Sciences
>> > Vol. 4, N. 1, 160-177
>> >
>> >
>> > ----------------------------------------------------------------------
>> > 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