cmatrix.Matrix.swap_line

Matrix.swap_line()

Swap the two given lines of the self matrix object from the given a and b index

Parameters

Type

Description

a

int

the first line index

b

int

the second line index

Returns
Matrix

The matrix with a-th and b-th line swaped

Examples

>>> m=rand(4)
>>> print(m)
| +13.000 | +5.000 | +8.000 | +1.000 |
| +13.000 | +13.000 | +6.000 | +5.000 |
| +16.000 | +0.000 | +0.000 | +0.000 |
| +10.000 | +2.000 | +16.000 | +13.000 |
printed
>>> print(m.swap_line(0,2))
| +16.000 | +0.000 | +0.000 | +0.000 |
| +13.000 | +13.000 | +6.000 | +5.000 |
| +13.000 | +5.000 | +8.000 | +1.000 |
| +10.000 | +2.000 | +16.000 | +13.000 |
printed