]> www.ginac.de Git - ginac.git/blobdiff - ginac/symmetry.cpp
- prepared for 1.0.13 release
[ginac.git] / ginac / symmetry.cpp
index 1deb1cfad3a1960ce31cb0ca30ada611ce7655ac..536d1cd5115c31edf125ce83693afdd4792dd667 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's symmetry definitions. */
 
 /*
  *  Implementation of GiNaC's symmetry definitions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2001 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
  *
  *  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
@@ -20,9 +20,9 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <iostream>
 #include <stdexcept>
 #include <functional>
 #include <stdexcept>
 #include <functional>
-#include <algorithm>
 
 #include "symmetry.h"
 #include "lst.h"
 
 #include "symmetry.h"
 #include "lst.h"
@@ -304,7 +304,7 @@ public:
 
 int canonicalize(exvector::iterator v, const symmetry &symm)
 {
 
 int canonicalize(exvector::iterator v, const symmetry &symm)
 {
-       // Less than two indices? Then do nothing
+       // Less than two elements? Then do nothing
        if (symm.indices.size() < 2)
                return INT_MAX;
 
        if (symm.indices.size() < 2)
                return INT_MAX;
 
@@ -334,6 +334,8 @@ int canonicalize(exvector::iterator v, const symmetry &symm)
                case symmetry::antisymmetric:
                        // Sort the children in ascending order, keeping track of the signum
                        sign *= permutation_sign(first, last, sy_is_less(v), sy_swap(v, something_changed));
                case symmetry::antisymmetric:
                        // Sort the children in ascending order, keeping track of the signum
                        sign *= permutation_sign(first, last, sy_is_less(v), sy_swap(v, something_changed));
+                       if (sign == 0)
+                               return 0;
                        break;
                case symmetry::cyclic:
                        // Permute the smallest child to the front
                        break;
                case symmetry::cyclic:
                        // Permute the smallest child to the front