GiNaC  1.6.2
tensor.h
Go to the documentation of this file.
00001 
00005 /*
00006  *  GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany
00007  *
00008  *  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; either version 2 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU General Public License
00019  *  along with this program; if not, write to the Free Software
00020  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021  */
00022 
00023 #ifndef GINAC_TENSOR_H
00024 #define GINAC_TENSOR_H
00025 
00026 #include "ex.h"
00027 #include "archive.h"
00028 
00029 namespace GiNaC {
00030 
00034 class tensor : public basic
00035 {
00036     GINAC_DECLARE_REGISTERED_CLASS(tensor, basic)
00037 
00038     // functions overriding virtual functions from base classes
00039 protected:
00040     unsigned return_type() const { return return_types::noncommutative_composite; }
00041 
00042     // non-virtual functions in this class
00043 public:
00047     bool replace_contr_index(exvector::iterator self, exvector::iterator other) const;
00048 };
00049 
00050 
00053 class tensdelta : public tensor
00054 {
00055     GINAC_DECLARE_REGISTERED_CLASS(tensdelta, tensor)
00056 
00057     // functions overriding virtual functions from base classes
00058 public:
00059     bool info(unsigned inf) const;
00060     ex eval_indexed(const basic & i) const;
00061     bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const;
00062 
00063     // non-virtual functions in this class
00064 protected:
00065     unsigned return_type() const { return return_types::commutative; }
00066     void do_print(const print_context & c, unsigned level) const;
00067     void do_print_latex(const print_latex & c, unsigned level) const;
00068 };
00069 GINAC_DECLARE_UNARCHIVER(tensdelta);
00070 
00071 
00075 class tensmetric : public tensor
00076 {
00077     GINAC_DECLARE_REGISTERED_CLASS(tensmetric, tensor)
00078 
00079     // functions overriding virtual functions from base classes
00080 public:
00081     bool info(unsigned inf) const;
00082     ex eval_indexed(const basic & i) const;
00083     bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const;
00084 
00085     // non-virtual functions in this class
00086 protected:
00087     unsigned return_type() const { return return_types::commutative; }
00088     void do_print(const print_context & c, unsigned level) const;
00089 };
00090 GINAC_DECLARE_UNARCHIVER(tensmetric);
00091 
00092 
00096 class minkmetric : public tensmetric
00097 {
00098     GINAC_DECLARE_REGISTERED_CLASS(minkmetric, tensmetric)
00099 
00100     // other constructors
00101 public:
00103     minkmetric(bool pos_sig);
00104 
00105     // functions overriding virtual functions from base classes
00106 public:
00107     bool info(unsigned inf) const;
00108     ex eval_indexed(const basic & i) const;
00109 
00111     void archive(archive_node& n) const;
00113     void read_archive(const archive_node& n, lst& syms);
00114     // non-virtual functions in this class
00115 protected:
00116     unsigned return_type() const { return return_types::commutative; }
00117     void do_print(const print_context & c, unsigned level) const;
00118     void do_print_latex(const print_latex & c, unsigned level) const;
00119 
00120     // member variables
00121 private:
00122     bool pos_sig; 
00123 };
00124 GINAC_DECLARE_UNARCHIVER(minkmetric); 
00125 
00126 
00131 class spinmetric : public tensmetric
00132 {
00133     GINAC_DECLARE_REGISTERED_CLASS(spinmetric, tensmetric)
00134 
00135     // functions overriding virtual functions from base classes
00136 public:
00137     bool info(unsigned inf) const;
00138     ex eval_indexed(const basic & i) const;
00139     bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const;
00140 
00141 protected:
00142     void do_print(const print_context & c, unsigned level) const;
00143     void do_print_latex(const print_latex & c, unsigned level) const;
00144 };
00145 GINAC_DECLARE_UNARCHIVER(spinmetric);
00146 
00147 
00151 class tensepsilon : public tensor
00152 {
00153     GINAC_DECLARE_REGISTERED_CLASS(tensepsilon, tensor)
00154 
00155     // other constructors
00156 public:
00157     tensepsilon(bool minkowski, bool pos_sig);
00158 
00159     // functions overriding virtual functions from base classes
00160 public:
00161     bool info(unsigned inf) const;
00162     ex eval_indexed(const basic & i) const;
00163     bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const;
00164 
00166     void archive(archive_node& n) const;
00168     void read_archive(const archive_node& n, lst& syms);
00169     // non-virtual functions in this class
00170 protected:
00171     unsigned return_type() const { return return_types::commutative; }
00172     void do_print(const print_context & c, unsigned level) const;
00173     void do_print_latex(const print_latex & c, unsigned level) const;
00174 
00175     // member variables
00176 private:
00177     bool minkowski; 
00178     bool pos_sig;   
00179 };
00180 GINAC_DECLARE_UNARCHIVER(tensepsilon); 
00181 
00182 
00183 // utility functions
00184 
00192 ex delta_tensor(const ex & i1, const ex & i2);
00193 
00201 ex metric_tensor(const ex & i1, const ex & i2);
00202 
00212 ex lorentz_g(const ex & i1, const ex & i2, bool pos_sig = false);
00213 
00222 ex spinor_metric(const ex & i1, const ex & i2);
00223 
00230 ex epsilon_tensor(const ex & i1, const ex & i2);
00231 
00239 ex epsilon_tensor(const ex & i1, const ex & i2, const ex & i3);
00240 
00250 ex lorentz_eps(const ex & i1, const ex & i2, const ex & i3, const ex & i4, bool pos_sig = false);
00251 
00252 } // namespace GiNaC
00253 
00254 #endif // ndef GINAC_TENSOR_H

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.