cmatrix.Matrix.swap_col

Matrix.swap_col()

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

Parameters

Type

Description

a

int

the first column index

b

int

the second column index

Returns
Matrix

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

Examples

>>> m=rand(4)
>>> print(m)
| +4.000 | +14.000 | +10.000 | +16.000 |
| +7.000 | +9.000 | +13.000 | +9.000 |
| +3.000 | +7.000 | +7.000 | +6.000 |
| +3.000 | +2.000 | +9.000 | +16.000 |
printed
>>> print(m.swap_col(0,2))
| +10.000 | +14.000 | +4.000 | +16.000 |
| +13.000 | +9.000 | +7.000 | +9.000 |
| +7.000 | +7.000 | +3.000 | +6.000 |
| +9.000 | +2.000 | +3.000 | +16.000 |
printed