cmatrix.Matrix.op¶
- Matrix.op()¶
Standard operators factorization
Eventually complete the description with details as :
The given operator as a string is interpreted and the corresponding computing is returned
Parameters
Type
Description
mat2
Matrix
The matrix second term
op
String
- the operation to realize between :
: add
: sub
: multiply
& : logic and
- : logic or
~ : logic nand
¤ : logic nor
¨ : logic xor
Examples
>>> # Decimal Operator Factorisation >>> t=gaussian(5,1,0) >>> Print(t) # initializing | +1.000 | +2.000 | +4.000 | +2.000 | +1.000 | | +2.000 | +4.000 | +8.000 | +4.000 | +2.000 | | +4.000 | +8.000 | +16.000 | +8.000 | +4.000 | | +2.000 | +4.000 | +8.000 | +4.000 | +2.000 | | +1.000 | +2.000 | +4.000 | +2.000 | +1.000 | printed >>> u=unit(5)*100 >>> Print(u) # initializing | +100.000 | +0.000 | +0.000 | +0.000 | +0.000 | | +0.000 | +100.000 | +0.000 | +0.000 | +0.000 | | +0.000 | +0.000 | +100.000 | +0.000 | +0.000 | | +0.000 | +0.000 | +0.000 | +100.000 | +0.000 | | +0.000 | +0.000 | +0.000 | +0.000 | +100.000 | printed >>> Print(t.op(u,'+')) # applying operator | +101.000 | +2.000 | +4.000 | +2.000 | +1.000 | | +2.000 | +104.000 | +8.000 | +4.000 | +2.000 | | +4.000 | +8.000 | +116.000 | +8.000 | +4.000 | | +2.000 | +4.000 | +8.000 | +104.000 | +2.000 | | +1.000 | +2.000 | +4.000 | +2.000 | +101.000 | printed >>> Print(t.op(u,'-')) # applying operator | -99.000 | +2.000 | +4.000 | +2.000 | +1.000 | | +2.000 | -96.000 | +8.000 | +4.000 | +2.000 | | +4.000 | +8.000 | -84.000 | +8.000 | +4.000 | | +2.000 | +4.000 | +8.000 | -96.000 | +2.000 | | +1.000 | +2.000 | +4.000 | +2.000 | -99.000 | printed >>> Print(t.op(u,'*')) # applying operator | +100.000 | +200.000 | +400.000 | +200.000 | +100.000 | | +200.000 | +400.000 | +800.000 | +400.000 | +200.000 | | +400.000 | +800.000 | +1600.000 | +800.000 | +400.000 | | +200.000 | +400.000 | +800.000 | +400.000 | +200.000 | | +100.000 | +200.000 | +400.000 | +200.000 | +100.000 | printed >>> # Binary Operator Factorisation >>> t=rand_perm(3) >>> Print(t) | +1.000 | +0.000 | +0.000 | | +0.000 | +0.000 | +1.000 | | +0.000 | +1.000 | +0.000 | printed >>> u=unit(3) >>> Print(u) | +1.000 | +0.000 | +0.000 | | +0.000 | +1.000 | +0.000 | | +0.000 | +0.000 | +1.000 | printed >>> # Logical And >>> Print(t.op(u,'&')) | +1.000 | +0.000 | +0.000 | | +0.000 | +0.000 | +0.000 | | +0.000 | +0.000 | +0.000 | printed >>> # Logical Or >>> Print(t.op(u,'|')) | +1.000 | +0.000 | +0.000 | | +0.000 | +1.000 | +1.000 | | +0.000 | +1.000 | +1.000 | printed >>> # Logical Nand >>> Print(t.op(u,'~')) | +0.000 | +1.000 | +1.000 | | +1.000 | +1.000 | +1.000 | | +1.000 | +1.000 | +1.000 | printed >>> # Logical Nor >>> Print(t.op(u,'¤')) | +0.000 | +1.000 | +1.000 | | +1.000 | +0.000 | +0.000 | | +1.000 | +0.000 | +0.000 | printed >>> # Logical Xor >>> Print(t.op(u,'¨')) | +0.000 | +0.000 | +0.000 | | +0.000 | +1.000 | +1.000 | | +0.000 | +1.000 | +1.000 | printed