Matrix multiplication: Difference between revisions
Content added Content deleted
(Matrix multiplication en Yabasic) |
mNo edit summary |
||
Line 521: | Line 521: | ||
exception index error: |
exception index error: |
||
putf(stand error, $x"Exception: index error."l$) |
putf(stand error, $x"Exception: index error."l$) |
||
=={{header|Amazing Hopper}}== |
|||
<lang Amazing Hopper> |
|||
#include <hopper.h> |
|||
main: |
|||
first matrix=0, second matrix=0,a=-1 |
|||
{5,2},rand array(a),mulby(10),ceil, cpy(first matrix), puts,{"\n"},puts |
|||
{2,3},rand array(a),mulby(10),ceil, cpy(second matrix), puts,{"\n"},puts |
|||
{first matrix,second matrix},mat mul, println |
|||
exit(0) |
|||
</lang> |
|||
Alternatively, the follow code in macro-natural-Hopper: |
|||
<lang Amazing Hopper> |
|||
#include <natural.h> |
|||
#include <hopper.h> |
|||
main: |
|||
get a matrix of '5,2' integer random numbers, remember it in 'first matrix' and put it with a newline |
|||
get a matrix of '2,3' integer random numbers, remember it in 'second matrix' and put it with a newline |
|||
now take 'first matrix', and take 'second matrix', and multiply it; then, print with a new line. |
|||
exit(0) |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
2 2 |
|||
1 5 |
|||
3 4 |
|||
6 6 |
|||
4 8 |
|||
7 1 6 |
|||
6 2 4 |
|||
26 6 20 |
|||
37 11 26 |
|||
45 11 34 |
|||
78 18 60 |
|||
76 20 56 |
|||
</pre> |
|||
=={{header|APL}}== |
=={{header|APL}}== |