Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Element-wise-operations/Zkl/element-wise-operations.zkl
Normal file
12
Task/Element-wise-operations/Zkl/element-wise-operations.zkl
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
var [const] GSL=Import("zklGSL"); // libGSL (GNU Scientific Library)
|
||||
M:=GSL.Matrix(3,3).set(3,5,7, 1,2,3, 2,4,6);
|
||||
x:=2;
|
||||
println("M = \n%s\nx = %s".fmt(M.format(),x));
|
||||
foreach op in (T('+,'-,'*,'/)){
|
||||
println("M %s x:\n%s\n".fmt(op.toString()[3,1],op(M.copy(),x).format()));
|
||||
}
|
||||
foreach op in (T("addElements","subElements","mulElements","divElements")){
|
||||
println("M %s M:\n%s\n".fmt(op, M.copy().resolve(op)(M).format()));
|
||||
}
|
||||
mSqrd:=M.pump(0,M.copy(),fcn(x){ x*x }); // M element by element
|
||||
println("M square elements:\n%s\n".fmt(mSqrd.format()));
|
||||
Loading…
Add table
Add a link
Reference in a new issue