10. Setitem function¶
Genericity polymorphism ‘setitem’ function
Parameters |
type |
Description |
key |
tuple |
i,j values |
value |
double |
the value to set |
value |
Matrix |
the sub-matrix to set from (i,j) arg |
10.1. Returns¶
- Matrix
The self matrix updated with new value(s)
10.2. Examples¶
>>> m=Matrix(4,4)
>>> insert=rand(2)
>>> print(insert)
| +3.000 | +4.000 |
| +3.000 | +1.000 |
printed
>>> m[0,0]=insert
>>> print(m)
| +3.000 | +4.000 | +0.000 | +0.000 |
| +3.000 | +1.000 | +0.000 | +0.000 |
| +0.000 | +0.000 | +0.000 | +0.000 |
| +0.000 | +0.000 | +0.000 | +0.000 |
printed
>>> m[3,3]=10.123456
>>> print(m)
| +3.000 | +4.000 | +0.000 | +0.000 |
| +3.000 | +1.000 | +0.000 | +0.000 |
| +0.000 | +0.000 | +0.000 | +0.000 |
| +0.000 | +0.000 | +0.000 | +10.123 |
printed
10.3. See Also¶
cmatrix.set_ij()
cmatrix.insert_sub_matrix()