]> www.ginac.de Git - ginac.git/blobdiff - ginac/lortensor.cpp
* New funny timing added: compute an antipode in Yukawa theory.
[ginac.git] / ginac / lortensor.cpp
index fc3433ffac48477b76a171e746871d5e7449c557..1dae91a6dcb2b1f88e4f4c35ac50d7a29efd57d1 100644 (file)
@@ -1,7 +1,6 @@
 /** @file lortensor.cpp
  *
- *  Implementation of GiNaCĀ“s lortensor objects.
- *  No real implementation yet, do be done.      */
+ *  Implementation of GiNaC's Lorentz tensors. */
 
 /*
  *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
@@ -32,7 +31,6 @@
 #include "add.h"
 #include "mul.h"
 #include "debugmsg.h"
-#include "flags.h"
 #include "lst.h"
 #include "lortensor.h"
 #include "operators.h"
@@ -42,9 +40,7 @@
 #include "utils.h"
 #include "config.h"
 
-#ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
-#endif // ndef NO_NAMESPACE_GINAC
 
 GINAC_IMPLEMENT_REGISTERED_CLASS(lortensor, indexed)
 
@@ -61,28 +57,6 @@ lortensor::lortensor() : inherited(TINFO_lortensor), type(invalid)
        name=autoname_prefix()+ToString(serial);
 }
 
-lortensor::~lortensor()
-{
-       debugmsg("lortensor destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-lortensor::lortensor(const lortensor & other)
-{
-       debugmsg("lortensor copy constructor",LOGLEVEL_CONSTRUCT);
-       copy (other);
-}
-
-const lortensor & lortensor::operator=(const lortensor & other)
-{
-       debugmsg("lortensor operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != & other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 //protected
 
 void lortensor::copy(const lortensor & other)
@@ -261,12 +235,6 @@ void lortensor::archive(archive_node &n) const
 
 //public
 
-basic * lortensor::duplicate() const
-{
-       debugmsg("lortensor duplicate",LOGLEVEL_DUPLICATE);
-       return new lortensor(*this);
-}
-
 void lortensor::printraw(std::ostream & os) const
 {
        debugmsg("lortensor printraw",LOGLEVEL_PRINT);
@@ -351,7 +319,10 @@ ex lortensor::eval(int level) const
                                return _ex0();
                        }
                } else if (idx1.is_symbolic() && idx1.is_co_contra_pair(idx2)) {
-                       return Dim() - 2;
+                       if (idx1.is_orthogonal_only())
+                               return Dim() - idx1.get_dim_parallel_space();
+                       else
+                               return Dim();
                }
        }
        return this -> hold();
@@ -581,7 +552,7 @@ ex simplify_lortensor_mul(const ex & m)
 ex simplify_lortensor(const ex & e)
 {
        // all simplification is done on expanded objects
-       ex e_expanded=e.expand();
+       ex e_expanded = e.expand();
 
        // simplification of sum=sum of simplifications
        if (is_ex_exactly_of_type(e_expanded,add)) {
@@ -601,13 +572,4 @@ ex simplify_lortensor(const ex & e)
        return e_expanded;
 }
 
-//////////
-// global constants
-//////////
-
-const lortensor some_lortensor;
-const std::type_info & typeid_lortensor = typeid(some_lortensor);
-
-#ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
-#endif // ndef NO_NAMESPACE_GINAC