@@ -748,16 +748,20 @@ def test_right_multiplication_matrix(self, algebra, rng): # noqa: F811
748748 operator .xor , # outer product
749749 operator .or_ , # inner product
750750 ])
751- def test_swapped_operands (self , algebra , rng , func ): # noqa: F811
752- layout = algebra
753- for _ in range (10 ):
754- mv = layout .randomMV (rng = rng )
755- mv2 = layout .randomMV (rng = rng )
756- # Convert first operand to MVArray. This provokes use of operation with
757- # swapped operands: MultiVector.__rmul__, __ror__, etc.
758- ma = clifford .MVArray (mv )
759- np .testing .assert_equal (func (ma , mv2 ), func (mv , mv2 ))
760- np .testing .assert_equal (func (mv2 , ma ), func (mv2 , mv ))
751+ def test_swapped_operands (self , g3 , func ):
752+ layout = g3
753+ e1 = layout .blades ['e1' ]
754+ e2 = layout .blades ['e2' ]
755+ e12 = layout .blades ['e12' ]
756+ # Pick two numbers with non-commutative products
757+ # e1^e2 == -e2^e1, e1|e12 == -e12|e1
758+ mv = 1 * e1 + 2 * e2
759+ mv2 = 3 * e1 + 5 * e12
760+ # Convert first operand to MVArray. This provokes use of operation with
761+ # swapped operands: MultiVector.__rmul__, __ror__, etc.
762+ ma = clifford .MVArray (mv )
763+ np .testing .assert_equal (func (ma , mv2 ), func (mv , mv2 ))
764+ np .testing .assert_equal (func (mv2 , ma ), func (mv2 , mv ))
761765
762766
763767class TestPrettyRepr :
0 commit comments