cmatrix.Matrix.resize

Matrix.resize()

Resize the self matrix from given float ratio. A ratio of 0.5 mean the half matrix as a result

Parameters

Type

Description

ratio

float

The ratio of resizing

Returns
Matrix

The proportionnaly resized matrix.

Examples

>>> from matrix import *
>>> t=rand(8)
>>> Print(t)
| +40.000 | +17.000 | +61.000 | +56.000 | +60.000 | +4.000 | +52.000 | +55.000 |
| +27.000 | +12.000 | +27.000 | +29.000 | +9.000 | +22.000 | +50.000 | +57.000 |
| +45.000 | +32.000 | +24.000 | +40.000 | +29.000 | +16.000 | +10.000 | +12.000 |
| +13.000 | +28.000 | +27.000 | +46.000 | +1.000 | +57.000 | +34.000 | +25.000 |
| +63.000 | +22.000 | +39.000 | +55.000 | +2.000 | +22.000 | +26.000 | +15.000 |
| +1.000 | +11.000 | +25.000 | +3.000 | +15.000 | +43.000 | +14.000 | +6.000 |
| +54.000 | +42.000 | +59.000 | +53.000 | +23.000 | +35.000 | +54.000 | +13.000 |
| +44.000 | +38.000 | +31.000 | +64.000 | +47.000 | +32.000 | +5.000 | +44.000 |
printed
>>> Print(t.resize(0.5))
| +40.000 | +61.000 | +60.000 | +52.000 |
| +45.000 | +24.000 | +29.000 | +10.000 |
| +63.000 | +39.000 | +2.000 | +26.000 |
| +54.000 | +59.000 | +23.000 | +54.000 |
printed