43 lines
1.5 KiB
Text
43 lines
1.5 KiB
Text
;Task:
|
|
Implement the [[wp:Kronecker_product|Kronecker product]] of two matrices (arbitrary sized) resulting in a block matrix. <br />
|
|
|
|
|
|
;Test cases:
|
|
Show results for each of the following two samples:<br>
|
|
|
|
|
|
Sample 1 (from Wikipedia):
|
|
<pre>
|
|
|
|
|
|
┌ ┐ ┌ ┐ ┌ ┐
|
|
│1 2│ │0 5│ │ 0 5 0 10│
|
|
│3 4│ x │6 7│ = │ 6 7 12 14│
|
|
└ ┘ └ ┘ │ 0 15 0 20│
|
|
│18 21 24 28│
|
|
└ ┘
|
|
</pre>
|
|
|
|
Sample 2:
|
|
<pre>
|
|
┌ ┐ ┌ ┐ ┌ ┐
|
|
│0 1 0│ │1 1 1 1│ │0 0 0 0 1 1 1 1 0 0 0 0│
|
|
│1 1 1│ x │1 0 0 1│ = │0 0 0 0 1 0 0 1 0 0 0 0│
|
|
│0 1 0│ │1 1 1 1│ │0 0 0 0 1 1 1 1 0 0 0 0│
|
|
└ ┘ └ ┘ │1 1 1 1 1 1 1 1 1 1 1 1│
|
|
│1 0 0 1 1 0 0 1 1 0 0 1│
|
|
│1 1 1 1 1 1 1 1 1 1 1 1│
|
|
│0 0 0 0 1 1 1 1 0 0 0 0│
|
|
│0 0 0 0 1 0 0 1 0 0 0 0│
|
|
│0 0 0 0 1 1 1 1 0 0 0 0│
|
|
└ ┘
|
|
</pre>
|
|
|
|
|
|
See implementations and results below in JavaScript and PARI/GP languages.
|
|
|
|
|
|
;Related task:
|
|
* [[Kronecker_product_based_fractals| Kronecker product based fractals]].
|
|
<br><br>
|
|
|