Esempio n. 1
0
    def test_inv_g4(self, g4):
        '''
        a numerical test for the inverse of a MV. truth was
        generated by results of clifford v0.82
        '''
        layout, blades = g4, g4.blades
        valA = np.array([
            -0.3184271488037198 , -0.8751064635010213 ,  # noqa
            -1.5011710376191947 ,  1.7946332649746224 ,  # noqa
            -0.8899576254164621 , -0.3297631748225678 ,  # noqa
             0.04310366054166925,  1.3970365638677635 ,  # noqa
            -1.545423393858595  ,  1.7790215501876614 ,  # noqa
             0.4785341530609175 , -1.32279679741638   ,  # noqa
             0.5874769077573831 , -1.0227287710873676 ,  # noqa
             1.779673249468527  , -1.5415648119743852    # noqa
        ])

        valAinv = np.array([
             0.06673424072253006 , -0.005709960252678998,  # noqa
            -0.10758540037163118 ,  0.1805895938775471  ,  # noqa
             0.13919236400967427 ,  0.04123255613093294 ,  # noqa
            -0.015395162562329407, -0.1388977308136247  ,  # noqa
            -0.1462160646855434  , -0.1183453106997158  ,  # noqa
            -0.06961956152268277 ,  0.1396713851886765  ,  # noqa
            -0.02572904638749348 ,  0.02079613649197489 ,  # noqa
            -0.06933660606043765 , -0.05436077710009021    # noqa
        ])

        A = MultiVector(layout=layout, value=valA)
        Ainv = MultiVector(layout=layout, value=valAinv)

        np.testing.assert_almost_equal(A.inv().value, Ainv.value)
Esempio n. 2
0
    def test_exp_g4(self):
        '''
        a numerical test for the exponential of a bivector. truth was
        generated by results of clifford v0.82
        '''
        layout, blades = self.algebras[1] # g4

        valB = np.array([-0.                 ,  0.                 ,  0.                 ,
               -0.                 , -0.                 , -1.9546896043012914 ,
                0.7069828848351363 , -0.22839793693302957,  1.0226966962560002 ,
                1.8673816483342143 , -1.7694566455296474 , -0.                 ,
               -0.                 ,  0.                 , -0.                 ,
               -0.                 ])
        valexpB = np.array([-0.8154675764311629  ,  0.                  ,
                0.                  ,  0.                  ,
                0.                  ,  0.3393508714682218  ,
                0.22959588097548828 , -0.1331099867581965  ,
               -0.01536404898029994 ,  0.012688721722814184,
                0.35678394795928464 ,  0.                  ,
                0.                  ,  0.                  ,
                0.                  , -0.14740840378445502 ])

        
        B = MultiVector(layout=layout,value=valB)
        expB =MultiVector(layout=layout,value=valexpB)
        np.testing.assert_almost_equal(exp(B).value,expB.value)