Kronecker product: Difference between revisions

Content added Content deleted
(Added C#)
m (added whitespace to the task's preamble, added "corner" glyphs to the matrices, centered one of the "times" symbol.)
Line 9:
;Test cases:
Show results for each of the following two samples:<br>
 
 
Sample 1 (from Wikipedia):
<pre>
┌ ┐ ┌ ┐ ┌ ┐
│1 2│ x │0 5│ = │ 0 5 0 10│
│3 4│ │6 7│ │1 2│ x │0 5│ =60 5 7 120 14│10│
│3 4│ │6 7│ │ 6 7 12 14│
└ ┘ └ ┘ │ 0 15 0 20│
│18 21 24 28│
└ ┘
</pre>
 
Sample 2:
<pre>
┌ ┐ ┌ ┐ ┌ ┐
│0 1 0│ x │1 1 1 1│ = │0 0 0 0 1 1 1 1 0 0 0 0│
│1 │0 1 1│0│ │1 01 01 1│ = │0 0 0 0 1 01 01 1 0 0 0 0│
│0 1 0│ │1 1 11│ x │1 0 0 1│ │0 0 0 0 1 10 10 1 0 0 0 0│
│0 1 0│ │1 1 1 11│ 1 1 1 │0 0 0 0 1 1 1 1 1│0 0 0 0│
│1 01 01 1 1 01 01 1 1 01 01 1│
│1 10 10 1 1 10 10 1 1 10 10 1│
│0 0 0 0 │1 1 1 1 1 01 01 01 1 1 1 0│1│
│0 0 0 0 1 01 01 1 0 0 0 0│
│0 0 0 0 1 10 10 1 0 0 0 0│
│0 1 0│ x │1 1 1 1│ = │0 0 0 0 1 1 1 1 0 0 0 0│
└ ┘
</pre>
 
 
See implementations and results below in JavaScript and PARI/GP languages.