cmatrix.Matrix.AtoB

Matrix.AtoB()

Compute the meaned matrix between self and given mat. Can be used to generate mutants matrix derivative/interpolated from self and mat.

Parameters

Type

Description

mat

Matrix

The matrix to mean with self

ratio

float

The balace ratio between matrix

Must be in [0,1]

Returns
Matrix

The linear interpolated matrix computed from the mat parameter and the ratio The ratio determine the multiplicative coefficient.

Examples

>>> Print(t)
| +1.000 | +4.000 | +6.000 | +4.000 | +1.000 |
| +4.000 | +16.000 | +24.000 | +16.000 | +4.000 |
| +6.000 | +24.000 | +36.000 | +24.000 | +6.000 |
| +4.000 | +16.000 | +24.000 | +16.000 | +4.000 |
| +1.000 | +4.000 | +6.000 | +4.000 | +1.000 |
printed
>>> Print(u)
| +1.000 | +0.000 | +0.000 | +0.000 | +0.000 |
| +0.000 | +1.000 | +0.000 | +0.000 | +0.000 |
| +0.000 | +0.000 | +1.000 | +0.000 | +0.000 |
| +0.000 | +0.000 | +0.000 | +1.000 | +0.000 |
| +0.000 | +0.000 | +0.000 | +0.000 | +1.000 |
printed
>>> v=t.AtoB(u) # 0.5 ration as default
>>> Print(v)
| +1.000 | +2.000 | +3.000 | +2.000 | +0.500 |
| +2.000 | +8.500 | +12.000 | +8.000 | +2.000 |
| +3.000 | +12.000 | +18.500 | +12.000 | +3.000 |
| +2.000 | +8.000 | +12.000 | +8.500 | +2.000 |
| +0.500 | +2.000 | +3.000 | +2.000 | +1.000 |
printed
>>> v=t.AtoB(u,0.1) # Personalize ratio as the last arg
>>> Print(v)
| +1.000 | +0.400 | +0.600 | +0.400 | +0.100 |
| +0.400 | +2.500 | +2.400 | +1.600 | +0.400 |
| +0.600 | +2.400 | +4.500 | +2.400 | +0.600 |
| +0.400 | +1.600 | +2.400 | +2.500 | +0.400 |
| +0.100 | +0.400 | +0.600 | +0.400 | +1.000 |
printed