September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
11
Task/Matrix-arithmetic/Zkl/matrix-arithmetic-1.zkl
Normal file
11
Task/Matrix-arithmetic/Zkl/matrix-arithmetic-1.zkl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
var [const] GSL=Import("zklGSL"); // libGSL (GNU Scientific Library)
|
||||
fcn perm(A){ // should verify A is square
|
||||
numRows:=A.rows;
|
||||
Utils.Helpers.permute(numRows.toList()).reduce( // permute(0,1,..numRows)
|
||||
'wrap(s,pm){ s + numRows.reduce('wrap(x,i){ x*A[i,pm[i]] },1.0) },
|
||||
0.0)
|
||||
}
|
||||
test:=fcn(A){
|
||||
println(A.format());
|
||||
println("Permanent: %.2f, determinant: %.2f".fmt(perm(A),A.det()));
|
||||
};
|
||||
5
Task/Matrix-arithmetic/Zkl/matrix-arithmetic-2.zkl
Normal file
5
Task/Matrix-arithmetic/Zkl/matrix-arithmetic-2.zkl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
A:=GSL.Matrix(2,2).set(1,2, 3,4);
|
||||
B:=GSL.Matrix(4,4).set(1,2,3,4, 4,5,6,7, 7,8,9,10, 10,11,12,13);
|
||||
C:=GSL.Matrix(5,5).set( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,
|
||||
15,16,17,18,19, 20,21,22,23,24);
|
||||
T(A,B,C).apply2(test);
|
||||
Loading…
Add table
Add a link
Reference in a new issue