I forgot, to remove the boxes one can use:


   rb=. >@:(,.&.>/)@:(,&.>/)

   rb A tsp B
 1  2  4  7  8 14  3 12 21
 4  5 16 28 20 35  6 24 42
 2  4  5  8 10 16  6 15 24
 8 10 20 32 25 40 12 30 48
 3  6  6  9 12 18  9 18 27
12 15 24 36 30 45 18 36 54
 7  8 28 49 32 56  9 36 63
14 16 35 56 40 64 18 45 72
21 24 42 63 48 72 27 54 81



(See, the same reference).


On Thu, May 1, 2014 at 3:00 PM, Jose Mario Quintana <
[email protected]> wrote:

> This is yet another way to define the products using an idea from Victor
> Cerovski (see, http://www.jsoftware.com/jwiki/Essays/Kronecker%20Product):
>
>    u Block=. (,./^:2)@:
> ,./^:2@:u
>
>    ( kp=. */ Block )                      NB. Kronecker
> ,./^:2@:(*/)
>    ( krp=. */Block &.> )                  NB. Khatri-Rao
> ,./^:2@:(*/)&.>
>    ( tsp=. (1 0 3 |: */)Block&.>/Block )  NB. Tracy-Singh
> ,./^:2@:(,./^:2@:(1 0 3 |: */)&.>/)
>
>   A krp B
> ┌─────┬─────┐
> │1 2  │12 21│
> │4 5  │24 42│
> ├─────┼─────┤
> │14 16│45 72│
> │21 24│54 81│
> └─────┴─────┘
>
>   A tsp B
> ┌─────┬───────────┬──┬─────┐
> │1 2  │ 4  7  8 14│3 │12 21│
> │4 5  │16 28 20 35│6 │24 42│
> ├─────┼───────────┼──┼─────┤
> │ 2  4│ 5  8 10 16│ 6│15 24│
> │ 8 10│20 32 25 40│12│30 48│
> │ 3  6│ 6  9 12 18│ 9│18 27│
> │12 15│24 36 30 45│18│36 54│
> ├─────┼───────────┼──┼─────┤
> │7 8  │28 49 32 56│9 │36 63│
> ├─────┼───────────┼──┼─────┤
> │14 16│35 56 40 64│18│45 72│
> │21 24│42 63 48 72│27│54 81│
> └─────┴───────────┴──┴─────┘
>
>
> The Khatri-Rao and the Tracy-Singh sums do not seem difficult to implement
> but I would rather wait to see concrete, inputs and outputs, examples
> before trying to code them.
>
>
> On Tue, Apr 29, 2014 at 7:03 PM, Jose Mario Quintana <
> [email protected]> wrote:
>
>> Your definitions reproduce the examples in
>> http://en.wikipedia.org/wiki/Khatri-Rao_product#Khatri-Rao_product :
>>
>>
>>
>>     ( A=. (;~1 0 1) <;.1 (1+i.3 3) )
>> ┌───┬─┐
>> │1 2│3│
>> │4 5│6│
>> ├───┼─┤
>> │7 8│9│
>> └───┴─┘
>>    ( B=. (;~1 1 0) <;.1 (|: 1+i.3 3) )
>> ┌─┬───┐
>> │1│4 7│
>> ├─┼───┤
>> │2│5 8│
>> │3│6 9│
>> └─┴───┘
>>    krp=. */block &.>  NB. Khatri-Rao product
>>    A krp B
>> ┌─────┬─────┐
>> │1 2  │12 21│
>> │4 5  │24 42│
>> ├─────┼─────┤
>> │14 16│45 72│
>> │21 24│54 81│
>> └─────┴─────┘
>>    tsp=. (1 0 3 |: */)block&.>/block  NB. Tracy-Singh product
>>    A tsp B
>> ┌─────┬───────────┬──┬─────┐
>> │1 2  │ 4  7  8 14│3 │12 21│
>> │4 5  │16 28 20 35│6 │24 42│
>> ├─────┼───────────┼──┼─────┤
>> │ 2  4│ 5  8 10 16│ 6│15 24│
>> │ 8 10│20 32 25 40│12│30 48│
>> │ 3  6│ 6  9 12 18│ 9│18 27│
>> │12 15│24 36 30 45│18│36 54│
>> ├─────┼───────────┼──┼─────┤
>> │7 8  │28 49 32 56│9 │36 63│
>> ├─────┼───────────┼──┼─────┤
>> │14 16│35 56 40 64│18│45 72│
>> │21 24│42 63 48 72│27│54 81│
>> └─────┴───────────┴──┴─────┘
>>
>>
>>
>> They are impressive!
>>
>>
>> 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

Reply via email to