コード例 #1
0
 def test_pack_columns(self):
     M = Matrix((3, 2))
     M1 = Matrix((3, 3))
     M1[0, 0] = 1
     M1[0, 2] = 2
     M1[2, 0] = 3
     M1[2, 2] = 4
     M1.packto(M, columns=[0, 2])
     np.testing.assert_equal(M, [[1, 2], [0, 0], [3, 4]])
コード例 #2
0
 def test_pack_rows(self):
     M = Matrix((2, 3))
     M1 = Matrix((3, 3))
     M1[0, 0] = 1
     M1[0, 2] = 2
     M1[2, 0] = 3
     M1[2, 2] = 4
     M1.packto(M, rows=[0, 2])
     np.testing.assert_equal(M, [[1, 0, 2], [3, 0, 4]])