Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,4 @@
|
|||
var [const] GSL=Import("zklGSL"); // libGSL (GNU Scientific Library)
|
||||
A:=GSL.Matrix(4,2).set(1,2, 3,4, 5,6, 7,8);
|
||||
B:=GSL.Matrix(2,3).set(1,2,3, 4,5,6);
|
||||
(A*B).format().println(); // creates a new matrix
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
fcn matMult(a,b){
|
||||
n,m,p:=a[0].len(),a.len(),b[0].len();
|
||||
ans:=(0).pump(m,List().write, (0).pump(p,List,0).copy); // matrix of zeros
|
||||
foreach i,j,k in (m,p,n){ ans[i][j]+=a[i][k]*b[k][j]; }
|
||||
ans
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
a:=L( L(1,2,), L(3,4,), L(5,6,), L(7,8) );
|
||||
b:=L( L(1,2,3,), L(4,5,6) );
|
||||
printM(matMult(a,b));
|
||||
|
||||
fcn printM(m){ m.pump(Console.println,rowFmt) }
|
||||
fcn rowFmt(row){ ("%4d "*row.len()).fmt(row.xplode()) }
|
||||
Loading…
Add table
Add a link
Reference in a new issue