Kronecker product: Difference between revisions
Content deleted Content added
Added Wren |
Alextretyak (talk | contribs) Added 11l |
||
Line 45: | Line 45: | ||
* [[Kronecker_product_based_fractals| Kronecker product based fractals]]. |
* [[Kronecker_product_based_fractals| Kronecker product based fractals]]. |
||
<br><br> |
<br><br> |
||
=={{header|11l}}== |
|||
{{trans|Python}} |
|||
<lang 11l>V a1 = [[1, 2], [3, 4]] |
|||
V b1 = [[0, 5], [6, 7]] |
|||
V a2 = [[0, 1, 0], [1, 1, 1], [0, 1, 0]] |
|||
V b2 = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 1, 1, 1]] |
|||
F kronecker(matrix1, matrix2) |
|||
[[Int]] final_list |
|||
[Int] sub_list |
|||
V count = matrix2.len |
|||
L(elem1) matrix1 |
|||
V counter = 0 |
|||
V check = 0 |
|||
L check < count |
|||
L(num1) elem1 |
|||
L(num2) matrix2[counter] |
|||
sub_list.append(num1 * num2) |
|||
counter++ |
|||
final_list.append(sub_list) |
|||
sub_list.drop() |
|||
check++ |
|||
R final_list |
|||
V result1 = kronecker(a1, b1) |
|||
L(elem) result1 |
|||
print(elem) |
|||
print(‘’) |
|||
V result2 = kronecker(a2, b2) |
|||
L(elem) result2 |
|||
print(elem)</lang> |
|||
{{out}} |
|||
<pre> |
|||
[0, 5, 0, 10] |
|||
[6, 7, 12, 14] |
|||
[0, 15, 0, 20] |
|||
[18, 21, 24, 28] |
|||
[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] |
|||
[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> |
|||
=={{header|360 Assembly}}== |
=={{header|360 Assembly}}== |