---------------------------> Sather 1.1 source file <-------------------------- -- Copyright (C) International Computer Science Institute, 1995. COPYRIGHT -- -- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject -- -- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in -- -- the file "Doc/License" of the Sather distribution. The license is also -- -- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA. -- --------> Please email comments to "sather-bugs@icsi.berkeley.edu". <---------- -- -- mat.sa -- implements VERY naive matrix multiplication used to benchmark compiler -- optimizations. -- V1.0: Februar 1996, by Claudio Fleiner class MYMAT{T} is include ARRAY2{T}; end; class MAIN is mult(r:MYMAT{FLT},m1:MYMAT{FLT},m2:MYMAT{FLT}) is loop i::=0.upto!(r.size1-1); loop j::=0.upto!(r.size2-1); sum:FLT:=0.0; loop k::=0.upto!(m1.size2-1); sum:=sum+m1[i,k]*m2[k,j]; end; r[j,i]:=sum; end; end; end; main(args: ARRAY{STR}) is n ::= #INT(args[1]); #OUT + "Doing it "+n+" times.\n"; m:MYMAT{FLT}:=#(200,200); loop n.times!; mult(m,m,m); end; end; end;