]> www.ginac.de Git - ginac.git/blobdiff - check/exam_clifford.cpp
lexer: when switching to another output stream, clean last read character.
[ginac.git] / check / exam_clifford.cpp
index 006c07694a6595dcc634faddaaee7f9210833d14..68393673f78d4672432ee82d499e5cb6b05204ee 100644 (file)
@@ -3,7 +3,7 @@
  *  Here we test GiNaC's Clifford algebra objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2007 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2008 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
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
 
 const numeric half(1, 2);
 
@@ -534,12 +537,24 @@ static unsigned clifford_check7(const ex & G, const symbol & dim)
        return result;
 }
 
+static unsigned clifford_check8()
+{
+       unsigned result = 0;
+
+       realsymbol a("a");
+       varidx mu(symbol("mu", "\\mu"), 1);
+
+       ex e = clifford_unit(mu, diag_matrix(lst(-1))), e0 = e.subs(mu==0);
+       result += ( exp(a*e0)*e0*e0 == -exp(e0*a) ) ? 0 : 1;
+
+       return result;
+}
+
 unsigned exam_clifford()
 {
        unsigned result = 0;
        
        cout << "examining clifford objects" << flush;
-       clog << "----------clifford objects:" << endl;
 
        result += clifford_check1(); cout << '.' << flush;
        result += clifford_check2(); cout << '.' << flush;
@@ -600,12 +615,12 @@ unsigned exam_clifford()
        result += clifford_check7(indexed(-2*minkmetric(), sy_symm(), xi, chi), dim); cout << '.' << flush;
        result += clifford_check7(-2*delta_tensor(xi, chi), dim); cout << '.' << flush;
 
-       if (!result) {
-               cout << " passed " << endl;
-               clog << "(no output)" << endl;
-       } else {
-               cout << " failed " << endl;
-       }
+       result += clifford_check8(); cout << '.' << flush;
 
        return result;
 }
+
+int main(int argc, char** argv)
+{
+       return exam_clifford();
+}