Matrix multiplication: Difference between revisions

Content added Content deleted
m (→‎{{header|MATLAB}} / {{header|Octave}}: There is a proper Octave entry below)
No edit summary
Line 3,365: Line 3,365:
29 40 51
29 40 51
39 54 69
39 54 69
</pre>

=={{header|Ring}}==
<lang ring>
load "stdlib.ring"
n = 3
A = newlist(n,n)
B = newlist(n,n)
C = newlist(n,n)
A = [[1,2,3], [4,5,6], [7,8,9]]
B = [[1,0,0], [0,1,0], [0,0,1]]
for i = 1 to n
for j = 1 to n
for k = 1 to n
C[i][k] += A[i][j] * B[j][k]
next
next
next
for i = 1 to n
for j = 1 to n
see C[i][j] + " "
next
see nl
next
</lang>
Output:
<pre>
123
456
789
</pre>
</pre>