Hi, Yesterday I was playing with the Kronecker product, trying to extend it to arbitrary dimensions (not that I really needed, but it seemed fun). It works on this J: JVERSION Engine: j902/j32/android Release-a: commercial/2020-12-24T11:35:03 Library: 9.02.08 Platform: Android 32 (armeabi-v7a) Installer: unknown InstallPath: /mnt/sdcard/Android/data/com.jsoftware.j.android/files Contact: www.jsoftware.com
But not on beta-r, nor beta-s on windows 64, avx2. The definition is as follows (based on https://wiki.jsoftware.com/wiki/Essays/Kronecker_Product): kp=: cs ($,) dp |: *"0 _ NB. cs calculates the eventual size of pairwise joining axes cs=: ([: */&:> >.&# {.!.1&.> ;)&$ NB. dp calculates the axis shuffle needed to interleave corresponding axes of x and y dp=: (+ {. [: ,@|:@i. 2 , >.)&(#@$) A=: =i. 3 NB. identity, shape 3 3 B=: >:i. 2 2 NB. shape 2 2 AA=: 0 13 26 e.~i. 3 3 NB. shape 3 3 3 'A kp B' and 'AA kp B' fail because 'A cs B' and 'AA cs B' throw a domain error in J903-beta-r/s I don't understand, but do work in J902. Dissect mentions an inconsistency, but eventually shows the right result. however, removing &$ from cs and feeding in shapes directly does work. 3 3 3 ([: */&:> >.&# {.!.1&.> ;) 2 2 6 6 3 Am I missing something or is this an interpreter bug? Any comments on the Kronecker product as such, does it make sense? The 2x2 case is at least consistent with the definitions in the essay. If it is sound, I'd add it to the Essay. Best regards, Jan-Pieter. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
