langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
26
Task/Matrix-multiplication/Seed7/matrix-multiplication.seed7
Normal file
26
Task/Matrix-multiplication/Seed7/matrix-multiplication.seed7
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
const type: matrix is array array float;
|
||||
|
||||
const func matrix: (in matrix: left) * (in matrix: right) is func
|
||||
result
|
||||
var matrix: result is matrix.value;
|
||||
local
|
||||
var integer: i is 0;
|
||||
var integer: j is 0;
|
||||
var integer: k is 0;
|
||||
var float: accumulator is 0.0;
|
||||
begin
|
||||
if length(left[1]) <> length(right) then
|
||||
raise RANGE_ERROR;
|
||||
else
|
||||
result := length(left) times length(right[1]) times 0.0;
|
||||
for i range 1 to length(left) do
|
||||
for j range 1 to length(right) do
|
||||
accumulator := 0.0;
|
||||
for k range 1 to length(left) do
|
||||
accumulator +:= left[i][k] * right[k][j];
|
||||
end for;
|
||||
result[i][j] := accumulator;
|
||||
end for;
|
||||
end for;
|
||||
end if;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue