- rotate_31() and golden_hash_ratio() moved to utils.h
[ginac.git] / ginac / color.cpp
index fc78506af58ff60576fffb476f95c7549e229647..b59e4b4ce1a030b340b1a248a6be6d4b070ef34e 100644 (file)
@@ -1,8 +1,9 @@
 /** @file color.cpp
  *
  *  Implementation of GiNaC's color objects.
- *  No real implementation yet, to be done.    
- *
+ *  No real implementation yet, to be done.     */
+
+/*
  *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
 #include <iostream>
 #include <stdexcept>
 
-#include "ginac.h"
+#include "color.h"
+#include "ex.h"
+#include "coloridx.h"
+#include "ncmul.h"
+#include "numeric.h"
+#include "relational.h"
+#include "debugmsg.h"
+
+namespace GiNaC {
 
 //////////
 // default constructor, destructor, copy constructor assignment operator and helpers
@@ -37,7 +46,7 @@
 color::color() : type(invalid), representation_label(0)
 {
     debugmsg("color default constructor",LOGLEVEL_CONSTRUCT);
-    tinfo_key=TINFO_COLOR;
+    tinfo_key=TINFO_color;
 }
 
 color::~color()
@@ -88,7 +97,7 @@ color::color(color_types const t, unsigned const rl) : type(t), representation_l
 {
     debugmsg("color constructor from color_types,unsigned",LOGLEVEL_CONSTRUCT);
     ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-    tinfo_key=TINFO_COLOR;
+    tinfo_key=TINFO_color;
     ASSERT(all_of_type_coloridx());
 }
 
@@ -97,7 +106,7 @@ color::color(color_types const t, ex const & i1, unsigned const rl)
 {
     debugmsg("color constructor from color_types,ex,unsigned",LOGLEVEL_CONSTRUCT);
     ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-    tinfo_key=TINFO_COLOR;
+    tinfo_key=TINFO_color;
     ASSERT(all_of_type_coloridx());
 }
 
@@ -106,7 +115,7 @@ color::color(color_types const t, ex const & i1, ex const & i2, unsigned const r
 {
     debugmsg("color constructor from color_types,ex,ex,unsigned",LOGLEVEL_CONSTRUCT);
     ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-    tinfo_key=TINFO_COLOR;
+    tinfo_key=TINFO_color;
     ASSERT(all_of_type_coloridx());
 }
 
@@ -115,7 +124,7 @@ color::color(color_types const t, ex const & i1, ex const & i2, ex const & i3,
 {
     debugmsg("color constructor from color_types,ex,ex,ex,unsigned",LOGLEVEL_CONSTRUCT);
     ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-    tinfo_key=TINFO_COLOR;
+    tinfo_key=TINFO_color;
     ASSERT(all_of_type_coloridx());
 }
 
@@ -124,7 +133,7 @@ color::color(color_types const t, exvector const & iv, unsigned const rl)
 {
     debugmsg("color constructor from color_types,exvector,unsigned",LOGLEVEL_CONSTRUCT);
     ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-    tinfo_key=TINFO_COLOR;
+    tinfo_key=TINFO_color;
     ASSERT(all_of_type_coloridx());
 }
 
@@ -133,7 +142,7 @@ color::color(color_types const t, exvector * ivp, unsigned const rl)
 {
     debugmsg("color constructor from color_types,exvector *,unsigned",LOGLEVEL_CONSTRUCT);
     ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
-    tinfo_key=TINFO_COLOR;
+    tinfo_key=TINFO_color;
     ASSERT(all_of_type_coloridx());
 }
 
@@ -338,7 +347,7 @@ ex color::eval(int level) const
 
 int color::compare_same_type(basic const & other) const
 {
-    ASSERT(other.tinfo() == TINFO_COLOR);
+    ASSERT(other.tinfo() == TINFO_color);
     const color *o = static_cast<const color *>(&other);
     if (type==o->type) {
         if (representation_label==o->representation_label) {
@@ -351,7 +360,7 @@ int color::compare_same_type(basic const & other) const
 
 bool color::is_equal_same_type(basic const & other) const
 {
-    ASSERT(other.tinfo() == TINFO_COLOR);
+    ASSERT(other.tinfo() == TINFO_color);
     const color *o = static_cast<const color *>(&other);
     if (type!=o->type) return false;
     if (representation_label!=o->representation_label) return false;
@@ -740,7 +749,7 @@ ex color_trace_of_one_representation_label(exvector const & v)
 
     v2.push_back(color_T(summation_index)); // don't care about the representation_label
     
-    // check this formula for SU(N) with N!=3 !!!!!!!!!
+    // FIXME: check this formula for SU(N) with N!=3
     return numeric(1)/numeric(2*COLOR_THREE)*color_delta8(next_to_last_index,last_index)
            % color_trace_of_one_representation_label(v1)
           +numeric(1)/numeric(2)*color_h(next_to_last_index,last_index,summation_index)
@@ -852,7 +861,7 @@ ex simplify_pure_color_string(ex const & e)
         }
     }
     
-    // TODO: higher contractions!!!!!!!!!!!!!
+    // FIXME: higher contractions
     
     return e;
 }
@@ -938,7 +947,7 @@ ex brute_force_sum_color_indices(ex const & e)
         
         // increment counter[]
         l=iv_double.size()-1;
-        while ((l>=0)&&((++counter[l])>COLOR_EIGHT)) {
+        while ((l>=0)&&((++counter[l])>(int)COLOR_EIGHT)) {
             counter[l]=1;    
             l--;
         }
@@ -956,15 +965,4 @@ void append_exvector_to_exvector(exvector & dest, exvector const & source)
     }
 }
 
-
-
-
-
-
-
-
-
-
-
-
-
+} // namespace GiNaC