cmatrix.Matrix.map¶
- Matrix.map()¶
Map a function (as parameter) to each element of the self matrix
Examples
>>> def Coef(x): ... return x*10 ... >>> m=rand(4) >>> print(m) | +14.000 | +9.000 | +5.000 | +2.000 | | +0.000 | +7.000 | +5.000 | +10.000 | | +2.000 | +10.000 | +0.000 | +2.000 | | +10.000 | +6.000 | +8.000 | +3.000 | printed >>> m.map(Coef) >>> print(m) | +140.000 | +90.000 | +50.000 | +20.000 | | +0.000 | +70.000 | +50.000 | +100.000 | | +20.000 | +100.000 | +0.000 | +20.000 | | +100.000 | +60.000 | +80.000 | +30.000 | printed