Kronecker product: Difference between revisions

Content added Content deleted
m (→‎{{header|RPL}}: HP-49 version)
Line 3,973: Line 3,973:
≪ DUP SIZE LIST→ DROP 4 ROLL DUP SIZE LIST→ DROP → b p q a m n
≪ DUP SIZE LIST→ DROP 4 ROLL DUP SIZE LIST→ DROP → b p q a m n
≪ {} m p * + n q * + 0 CON
≪ {} m p * + n q * + 0 CON
1 m p * FOR row
1 m p * '''FOR''' row
1 n q * FOR col
1 n q * '''FOR''' col
a {} row 1 - p / IP 1 + + col 1 - q / IP 1 + + GET
a {} row 1 - p / IP 1 + + col 1 - q / IP 1 + + GET
b {} row 1 - p MOD 1 + + col 1 - q MOD 1 + + GET
b {} row 1 - p MOD 1 + + col 1 - q MOD 1 + + GET
* {} row + col + SWAP PUT
* {} row + col + SWAP PUT
NEXT
'''NEXT NEXT'''
≫ ≫ '<span style="color:blue">KROKR</span>' STO
NEXT
====HP-49 version====
≫ ≫
≪ DUP SIZE LIST→ DROP 4 PICK SIZE LIST→ DROP → a b rb cb ra ca
´KROKR´ STO
≪ a SIZE b SIZE * 0 CON
0 ra 1 - '''FOR''' j
0 ca 1 - '''FOR''' k
{ 1 1 }
{ } j + k +
DUP2 ADD a SWAP GET UNROT
{ } ra + ca + * ADD
SWAP b * REPL
'''NEXT NEXT'''
≫ ≫ '<span style="color:blue">KROKR</span>' STO


[[1, 2], [3, 4]] [[0, 5], [6, 7]] KROKR
[[1, 2], [3, 4]] [[0, 5], [6, 7]] <span style="color:blue">KROKR</span>
[[0, 1, 0], [1, 1, 1], [0, 1, 0]] [[1, 1, 1, 1], [1, 0, 0, 1], [1, 1, 1, 1]] KROKR
[[0, 1, 0], [1, 1, 1], [0, 1, 0]] [[1, 1, 1, 1], [1, 0, 0, 1], [1, 1, 1, 1]] <span style="color:blue">KROKR</span>
{{out}}
{{out}}
<pre>
<pre>