]> www.ginac.de Git - ginac.git/blobdiff - check/exam_indexed.cpp
prepared for 1.0.13 release
[ginac.git] / check / exam_indexed.cpp
index a8c7cbd698f6da73a6673bb32e60cdfd44c387c9..82a2539f9df6a86423a617495c68644a69fdd378 100644 (file)
@@ -3,7 +3,7 @@
  *  Here we test manipulations on GiNaC's indexed objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2002 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -148,6 +148,11 @@ static unsigned epsilon_check(void)
        return result;
 }
 
+DECLARE_FUNCTION_2P(symm_fcn)
+REGISTER_FUNCTION(symm_fcn, set_symmetry(sy_symm(0, 1)));
+DECLARE_FUNCTION_2P(anti_fcn)
+REGISTER_FUNCTION(anti_fcn, set_symmetry(sy_anti(0, 1)));
+
 static unsigned symmetry_check(void)
 {
        // check symmetric/antisymmetric objects
@@ -155,7 +160,7 @@ static unsigned symmetry_check(void)
        unsigned result = 0;
 
        idx i(symbol("i"), 3), j(symbol("j"), 3), k(symbol("k"), 3), l(symbol("l"), 3);
-       symbol A("A"), B("B");
+       symbol A("A"), B("B"), C("C");
        ex e;
 
        result += check_equal(indexed(A, sy_symm(), i, j), indexed(A, sy_symm(), j, i));
@@ -187,6 +192,13 @@ static unsigned symmetry_check(void)
        result += check_equal(symmetrize(e), 0);
        result += check_equal(antisymmetrize(e), e);
 
+       e = (indexed(A, sy_anti(), i, j, k, l) * (indexed(B, j) * indexed(C, k) + indexed(B, k) * indexed(C, j)) + indexed(B, i, l)).expand();
+       result += check_equal_simplify(e, indexed(B, i, l));
+
+       result += check_equal(symm_fcn(0, 1) + symm_fcn(1, 0), 2*symm_fcn(0, 1));
+       result += check_equal(anti_fcn(0, 1) + anti_fcn(1, 0), 0);
+       result += check_equal(anti_fcn(0, 0), 0);
+
        return result;
 }