Anonymous user
Matrix multiplication: Difference between revisions
Added BBC BASIC
(→{{header|Go}}: added version with flat representation) |
(Added BBC BASIC) |
||
Line 340:
PRINT "invalid dimensions"
END IF
=={{header|BBC BASIC}}==
BBC BASIC has built-in matrix multiplication:
<lang bbcbasic> DIM matrix1(3,1), matrix2(1,2), product(3,2)
matrix1() = 1, 2, \
\ 3, 4, \
\ 5, 6, \
\ 7, 8
matrix2() = 1, 2, 3, \
\ 4, 5, 6
product() = matrix1() . matrix2()
FOR row% = 0 TO DIM(product(),1)
FOR col% = 0 TO DIM(product(),2)
PRINT product(row%,col%),;
NEXT
PRINT
NEXT
</lang>
Output:
<pre> 9 12 15
19 26 33
29 40 51
39 54 69</pre>
=={{header|C}}==
|