]> www.ginac.de Git - ginac.git/blobdiff - check/exam_indexed.cpp
adapted for new method of specifying symmetries
[ginac.git] / check / exam_indexed.cpp
index 10eb3d01e0b65b5dba44a18f4013cd264c918490..8f778311ccd0d49968ef780962ec0ea73803d111 100644 (file)
@@ -133,9 +133,9 @@ static unsigned epsilon_check(void)
        result += check_equal_simplify(lorentz_g(mu.toggle_variance(), nu.toggle_variance()) * lorentz_eps(mu, nu, rho, sigma), 0);
 
        // contraction with symmetric tensor is zero
        result += check_equal_simplify(lorentz_g(mu.toggle_variance(), nu.toggle_variance()) * lorentz_eps(mu, nu, rho, sigma), 0);
 
        // contraction with symmetric tensor is zero
-       result += check_equal_simplify(lorentz_eps(mu, nu, rho, sigma) * indexed(d, indexed::symmetric, mu.toggle_variance(), nu.toggle_variance()), 0);
-       result += check_equal_simplify(lorentz_eps(mu, nu, rho, sigma) * indexed(d, indexed::symmetric, nu.toggle_variance(), sigma.toggle_variance(), rho.toggle_variance()), 0);
-       ex e = lorentz_eps(mu, nu, rho, sigma) * indexed(d, indexed::symmetric, mu.toggle_variance(), tau);
+       result += check_equal_simplify(lorentz_eps(mu, nu, rho, sigma) * indexed(d, sy_symm(), mu.toggle_variance(), nu.toggle_variance()), 0);
+       result += check_equal_simplify(lorentz_eps(mu, nu, rho, sigma) * indexed(d, sy_symm(), nu.toggle_variance(), sigma.toggle_variance(), rho.toggle_variance()), 0);
+       ex e = lorentz_eps(mu, nu, rho, sigma) * indexed(d, sy_symm(), mu.toggle_variance(), tau);
        result += check_equal_simplify(e, e);
 
        return result;
        result += check_equal_simplify(e, e);
 
        return result;
@@ -151,16 +151,25 @@ static unsigned symmetry_check(void)
        symbol A("A"), B("B");
        ex e;
 
        symbol A("A"), B("B");
        ex e;
 
-       result += check_equal(indexed(A, indexed::symmetric, i, j), indexed(A, indexed::symmetric, j, i));
-       result += check_equal(indexed(A, indexed::antisymmetric, i, j) + indexed(A, indexed::antisymmetric, j, i), 0);
-       result += check_equal(indexed(A, indexed::antisymmetric, i, j, k) - indexed(A, indexed::antisymmetric, j, k, i), 0);
-       e = indexed(A, indexed::symmetric, i, j, k) *
-           indexed(B, indexed::antisymmetric, l, k, i);
+       result += check_equal(indexed(A, sy_symm(), i, j), indexed(A, sy_symm(), j, i));
+       result += check_equal(indexed(A, sy_anti(), i, j) + indexed(A, sy_anti(), j, i), 0);
+       result += check_equal(indexed(A, sy_anti(), i, j, k) - indexed(A, sy_anti(), j, k, i), 0);
+       e = indexed(A, sy_symm(), i, j, k) *
+           indexed(B, sy_anti(), l, k, i);
        result += check_equal_simplify(e, 0);
        result += check_equal_simplify(e, 0);
-       e = indexed(A, indexed::symmetric, i, i, j, j) *
-           indexed(B, indexed::antisymmetric, k, l); // GiNaC 0.8.0 had a bug here
+       e = indexed(A, sy_symm(), i, i, j, j) *
+           indexed(B, sy_anti(), k, l); // GiNaC 0.8.0 had a bug here
        result += check_equal_simplify(e, e);
 
        result += check_equal_simplify(e, e);
 
+       e = indexed(A, i, j);
+       result += check_equal(symmetrize(e) + antisymmetrize(e), e);
+       e = indexed(A, sy_symm(), i, j, k, l);
+       result += check_equal(symmetrize(e), e);
+       result += check_equal(antisymmetrize(e), 0);
+       e = indexed(A, sy_anti(), i, j, k, l);
+       result += check_equal(symmetrize(e), 0);
+       result += check_equal(antisymmetrize(e), e);
+
        return result;
 }
 
        return result;
 }
 
@@ -203,18 +212,18 @@ static unsigned edyn_check(void)
 
        // Lorentz transformation matrix (boost along x axis)
        matrix L(4, 4);
 
        // Lorentz transformation matrix (boost along x axis)
        matrix L(4, 4);
-       L.set(0, 0, gamma);
-       L.set(0, 1, -beta*gamma);
-       L.set(1, 0, -beta*gamma);
-       L.set(1, 1, gamma);
-       L.set(2, 2, 1); L.set(3, 3, 1);
+       L(0, 0) = gamma;
+       L(0, 1) = -beta*gamma;
+       L(1, 0) = -beta*gamma;
+       L(1, 1) = gamma;
+       L(2, 2) = 1; L(3, 3) = 1;
 
        // Electromagnetic field tensor
        matrix F(4, 4, lst(
                 0, -Ex, -Ey, -Ez,
                Ex,   0, -Bz,  By,
                Ey,  Bz,   0, -Bx,
 
        // Electromagnetic field tensor
        matrix F(4, 4, lst(
                 0, -Ex, -Ey, -Ez,
                Ex,   0, -Bz,  By,
                Ey,  Bz,   0, -Bx,
-               Ez, -By,  Bx // 0
+               Ez, -By,  Bx,   0
        ));
 
        // Indices
        ));
 
        // Indices