'i', 'd', or 'z', for integer, real
and complex matrices, respectively. A read-only attribute.
| ) |
A.T instead of A.trans().
| ) |
A.H instead of A.ctrans().
| ) |
| ) |
| f) |
| f) |
The last two methods are illustrated in the following example.
>>> from cvxopt.base import matrix
>>> A = matrix([[1.,2.,3.], [4.,5.,6.]])
>>> print A
1.0000e+00 4.0000e+00
2.0000e+00 5.0000e+00
3.0000e+00 6.0000e+00
>>> f = open('mat.bin','w')
>>> A.tofile(f)
>>> f.close()
>>> B = matrix(0.0, (2,3))
>>> f = open('mat.bin','r')
>>> B.fromfile(f)
>>> f.close()
>>> print B
1.0000e+00 3.0000e+00 5.0000e+00
2.0000e+00 4.0000e+00 6.0000e+00
Matrices can also be written to or read from files using the dump() and load() functions in the pickle module.