From: Jens Vollinga Date: Sun, 4 Jan 2004 16:11:45 +0000 (+0000) Subject: Added complex conjugation methods and GiNaC function "conjugate". X-Git-Tag: release_1-2-0~33 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=8dc09f48182574d792a2ed7c37b66831d9267a6c;ds=sidebyside Added complex conjugation methods and GiNaC function "conjugate". --- diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 01a29011..038cd7b5 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -3,7 +3,7 @@ * Implementation of GiNaC's ABC. */ /* - * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2004 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 @@ -674,6 +674,11 @@ exvector basic::get_free_indices() const return exvector(); // return an empty exvector } +ex basic::conjugate() const +{ + return *this; +} + ex basic::eval_ncmul(const exvector & v) const { return hold_ncmul(v); diff --git a/ginac/basic.h b/ginac/basic.h index 12a958c6..da634e08 100644 --- a/ginac/basic.h +++ b/ginac/basic.h @@ -3,7 +3,7 @@ * Interface to GiNaC's ABC. */ /* - * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2004 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 @@ -182,7 +182,11 @@ public: virtual unsigned return_type() const; virtual unsigned return_type_tinfo() const; -protected: // functions that should be called from class ex only + // complex conjugation + virtual ex conjugate() const; + + // functions that should be called from class ex only +protected: virtual int compare_same_type(const basic & other) const; virtual bool is_equal_same_type(const basic & other) const; diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index 7d4596d0..679def3a 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -3,7 +3,7 @@ * Implementation of GiNaC's clifford algebra (Dirac gamma) objects. */ /* - * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2004 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 @@ -484,6 +484,21 @@ ex clifford::thiscontainer(std::auto_ptr vp) const return clifford(representation_label, vp); } +ex diracgamma5::conjugate() const +{ + return _ex_1 * (*this); +} + +ex diracgammaL::conjugate() const +{ + return (new diracgammaR)->setflag(status_flags::dynallocated); +} + +ex diracgammaR::conjugate() const +{ + return (new diracgammaL)->setflag(status_flags::dynallocated); +} + ////////// // global functions ////////// diff --git a/ginac/clifford.h b/ginac/clifford.h index d7770796..7d6cc80e 100644 --- a/ginac/clifford.h +++ b/ginac/clifford.h @@ -3,7 +3,7 @@ * Interface to GiNaC's clifford algebra (Dirac gamma) objects. */ /* - * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2004 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 @@ -104,6 +104,9 @@ class diracgamma5 : public tensor { GINAC_DECLARE_REGISTERED_CLASS(diracgamma5, tensor) + // functions overriding virtual functions from base classes + ex conjugate() const; + // non-virtual functions in this class protected: void do_print(const print_context & c, unsigned level) const; @@ -117,6 +120,9 @@ class diracgammaL : public tensor { GINAC_DECLARE_REGISTERED_CLASS(diracgammaL, tensor) + // functions overriding virtual functions from base classes + ex conjugate() const; + // non-virtual functions in this class protected: void do_print(const print_context & c, unsigned level) const; @@ -130,6 +136,9 @@ class diracgammaR : public tensor { GINAC_DECLARE_REGISTERED_CLASS(diracgammaR, tensor) + // functions overriding virtual functions from base classes + ex conjugate() const; + // non-virtual functions in this class protected: void do_print(const print_context & c, unsigned level) const; diff --git a/ginac/container.h b/ginac/container.h index 2459b364..5d6fe3ac 100644 --- a/ginac/container.h +++ b/ginac/container.h @@ -3,7 +3,7 @@ * Wrapper template for making GiNaC classes out of STL containers. */ /* - * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2004 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 @@ -124,7 +124,6 @@ private: STLT & stlt; }; - /** Wrapper template for making GiNaC classes out of STL containers. */ template