Wenzel Jakob | 5708221 | 2015-09-04 23:42:12 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | from __future__ import print_function |
Wenzel Jakob | 38bd711 | 2015-07-05 20:05:44 +0200 | [diff] [blame] | 3 | import sys |
| 4 | sys.path.append('.') |
| 5 | |
| 6 | from example import Matrix |
| 7 | import numpy as np |
| 8 | |
| 9 | m = Matrix(5, 5) |
| 10 | |
| 11 | print(m[2, 3]) |
| 12 | m[2, 3] = 4 |
| 13 | print(m[2, 3]) |
| 14 | |
| 15 | m2 = np.array(m, copy=False) |
| 16 | print(m2) |
| 17 | print(m2[2, 3]) |
| 18 | m2[2, 3] = 5 |
| 19 | print(m[2, 3]) |
| 20 | |
| 21 | m3 = np.array([[1,2,3],[4,5,6]]).astype(np.float32) |
| 22 | print(m3) |
| 23 | m4 = Matrix(m3) |
| 24 | for i in range(m4.rows()): |
| 25 | for j in range(m4.cols()): |
| 26 | print(m4[i, j], end = ' ') |
| 27 | print() |