(self)
| 191 | |
| 192 | class TestCasting: |
| 193 | def test_basic(self): |
| 194 | A = np.arange(100).reshape(10, 10) |
| 195 | mA = matrix(A) |
| 196 | |
| 197 | mB = mA.copy() |
| 198 | O = np.ones((10, 10), np.float64) * 0.1 |
| 199 | mB = mB + O |
| 200 | assert_(mB.dtype.type == np.float64) |
| 201 | assert_(np.all(mA != mB)) |
| 202 | assert_(np.all(mB == mA+0.1)) |
| 203 | |
| 204 | mC = mA.copy() |
| 205 | O = np.ones((10, 10), np.complex128) |
| 206 | mC = mC * O |
| 207 | assert_(mC.dtype.type == np.complex128) |
| 208 | assert_(np.all(mA != mB)) |
| 209 | |
| 210 | |
| 211 | class TestAlgebra: |