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()));
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue