cmatrix.Matrix.tensorial_product

Matrix.tensorial_product()

Compute the tensorial product between self Matrix and the mat argument.

Parameters

type

Description

mat

Matrix

The second operand matrix

Returns
Matrix

The double sized matrix result of the tenso product

Examples

>>> #Matrix Tensor Profile
>>> m=rand(4)
>>> tensor=Matrix(2,2)
>>> tensor[0,0]=1
>>> tensor[0,1]=1
>>> tensor[1,0]=2
>>> tensor[1,1]=2
>>> print(m)
| +14.000 | +5.000 | +4.000 | +2.000 |
| +10.000 | +0.000 | +9.000 | +3.000 |
| +14.000 | +1.000 | +3.000 | +13.000 |
| +5.000 | +0.000 | +3.000 | +3.000 |
printed
>>> print(tensor)
| +1.000 | +1.000 |
| +2.000 | +2.000 |
printed
>>> print(m.tensorial_product(tensor))
| +14.000 | +5.000 | +4.000 | +2.000 | +14.000 | +5.000 | +4.000 | +2.000 |
| +20.000 | +0.000 | +18.000 | +6.000 | +20.000 | +0.000 | +18.000 | +6.000 |
| +14.000 | +1.000 | +3.000 | +13.000 | +14.000 | +1.000 | +3.000 | +13.000 |
| +10.000 | +0.000 | +6.000 | +6.000 | +10.000 | +0.000 | +6.000 | +6.000 |
| +14.000 | +5.000 | +4.000 | +2.000 | +14.000 | +5.000 | +4.000 | +2.000 |
| +20.000 | +0.000 | +18.000 | +6.000 | +20.000 | +0.000 | +18.000 | +6.000 |
| +14.000 | +1.000 | +3.000 | +13.000 | +14.000 | +1.000 | +3.000 | +13.000 |
| +10.000 | +0.000 | +6.000 | +6.000 | +10.000 | +0.000 | +6.000 | +6.000 |
printed
>>> #Vector Tensor Profile
>>> m=rand(4)
>>> print(m)
| +8.000 | +2.000 | +15.000 | +16.000 |
| +2.000 | +9.000 | +6.000 | +13.000 |
| +7.000 | +5.000 | +3.000 | +7.000 |
| +7.000 | +15.000 | +5.000 | +0.000 |
printed
>>> tensor=Matrix(2,1)
>>> tensor[0,0]=1
>>> tensor[1,0]=2
>>> print(m.tensorial_product(tensor))
| +8.000 | +2.000 | +15.000 | +16.000 |
| +16.000 | +4.000 | +30.000 | +32.000 |
| +8.000 | +2.000 | +15.000 | +16.000 |
| +16.000 | +4.000 | +30.000 | +32.000 |
| +2.000 | +9.000 | +6.000 | +13.000 |
| +4.000 | +18.000 | +12.000 | +26.000 |
| +2.000 | +9.000 | +6.000 | +13.000 |
| +4.000 | +18.000 | +12.000 | +26.000 |
printed