def test_change_of_basis(self): """ Test that change_of_basis() returns a correct change-of-basis matrix""" b1 = np.array([[0, 0, 1], [1, 0, 0], [0, 1, 0]]) # Generate a new basis as a rotation of pi/3 around z-axis b2 = np.dot(tr.rotation_matrix(np.pi / 3, axis=[0, 0, 1]), b1) cob = tr.change_of_basis(b1, b2) self.assertTrue(np.allclose(np.dot(cob, b1), b2))
def test_trivial(self): """ Test that change_of_basis() returns the identity operator for a trivial change of basis """ cob = tr.change_of_basis(np.eye(3), np.eye(3)) self.assertTrue(np.allclose(cob, np.eye(3)))