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