def test_cross_jacobi_identity(self): for v1, v2 in itertools.product(utils.ALL_VECTORS, utils.ALL_VECTORS): for v3 in utils.ALL_VECTORS: vec1 = vector_ops.cross(v1, vector_ops.cross(v2, v3)) vec2 = vector_ops.cross(v2, vector_ops.cross(v3, v1)) vec3 = vector_ops.cross(v3, vector_ops.cross(v1, v2)) utils.assert_vectors_almost_equal(vec1 + vec2 + vec3, Vector.make_zero(3))
def make_zero(cls, num_rows: int, num_columns: int): return cls(Vector.make_zero(num_columns) for _ in range(num_rows))
def test_cross_parallel(self): v1 = Vector([1, 0, 0]) v2 = Vector([2, 0, 0]) utils.assert_vectors_almost_equal(vector_ops.cross(v1, v2), Vector.make_zero(3))
def test_cross_self(self): for v1, v2 in itertools.product(utils.ALL_VECTORS, utils.ALL_VECTORS): if v1 == v2: vec = vector_ops.cross(v1, v2) utils.assert_vectors_almost_equal(vec, Vector.make_zero(3))
def test_make_zero(self): dim = 3 vec = Vector.make_zero(dim) self.assertEqual(vec.norm, 0, PRECISION) self.assertEqual(vec.dim, dim)