X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Ftensor.cpp;h=5f2c5506f15e0265e6e0a75fdb5eca27d9661efa;hb=640c8980ed3f00e985ffb4810b3c75a9b8106ba9;hp=ce865531b0b66405a9607f2d7588d2466254b1f8;hpb=4c47ecd9caa39ba1a31f5294e395fcbdf2006431;p=ginac.git diff --git a/ginac/tensor.cpp b/ginac/tensor.cpp index ce865531..5f2c5506 100644 --- a/ginac/tensor.cpp +++ b/ginac/tensor.cpp @@ -3,7 +3,7 @@ * Implementation of GiNaC's special tensors. */ /* - * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2015 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 @@ -20,10 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include -#include - #include "tensor.h" #include "idx.h" #include "indexed.h" @@ -36,6 +32,10 @@ #include "archive.h" #include "utils.h" +#include +#include +#include + namespace GiNaC { GINAC_IMPLEMENT_REGISTERED_CLASS(tensor, basic) @@ -576,7 +576,7 @@ bool tensepsilon::contract_with(exvector::iterator self, exvector::iterator othe ex delta_tensor(const ex & i1, const ex & i2) { - static ex delta = (new tensdelta)->setflag(status_flags::dynallocated); + static ex delta = dynallocate(); if (!is_a(i1) || !is_a(i2)) throw(std::invalid_argument("indices of delta tensor must be of type idx")); @@ -586,7 +586,7 @@ ex delta_tensor(const ex & i1, const ex & i2) ex metric_tensor(const ex & i1, const ex & i2) { - static ex metric = (new tensmetric)->setflag(status_flags::dynallocated); + static ex metric = dynallocate(); if (!is_a(i1) || !is_a(i2)) throw(std::invalid_argument("indices of metric tensor must be of type varidx")); @@ -596,8 +596,8 @@ ex metric_tensor(const ex & i1, const ex & i2) ex lorentz_g(const ex & i1, const ex & i2, bool pos_sig) { - static ex metric_neg = (new minkmetric(false))->setflag(status_flags::dynallocated); - static ex metric_pos = (new minkmetric(true))->setflag(status_flags::dynallocated); + static ex metric_neg = dynallocate(false); + static ex metric_pos = dynallocate(true); if (!is_a(i1) || !is_a(i2)) throw(std::invalid_argument("indices of metric tensor must be of type varidx")); @@ -607,7 +607,7 @@ ex lorentz_g(const ex & i1, const ex & i2, bool pos_sig) ex spinor_metric(const ex & i1, const ex & i2) { - static ex metric = (new spinmetric)->setflag(status_flags::dynallocated); + static ex metric = dynallocate(); if (!is_a(i1) || !is_a(i2)) throw(std::invalid_argument("indices of spinor metric must be of type spinidx")); @@ -619,7 +619,7 @@ ex spinor_metric(const ex & i1, const ex & i2) ex epsilon_tensor(const ex & i1, const ex & i2) { - static ex epsilon = (new tensepsilon)->setflag(status_flags::dynallocated); + static ex epsilon = dynallocate(); if (!is_a(i1) || !is_a(i2)) throw(std::invalid_argument("indices of epsilon tensor must be of type idx")); @@ -638,7 +638,7 @@ ex epsilon_tensor(const ex & i1, const ex & i2) ex epsilon_tensor(const ex & i1, const ex & i2, const ex & i3) { - static ex epsilon = (new tensepsilon)->setflag(status_flags::dynallocated); + static ex epsilon = dynallocate(); if (!is_a(i1) || !is_a(i2) || !is_a(i3)) throw(std::invalid_argument("indices of epsilon tensor must be of type idx")); @@ -657,8 +657,8 @@ ex epsilon_tensor(const ex & i1, const ex & i2, const ex & i3) ex lorentz_eps(const ex & i1, const ex & i2, const ex & i3, const ex & i4, bool pos_sig) { - static ex epsilon_neg = (new tensepsilon(true, false))->setflag(status_flags::dynallocated); - static ex epsilon_pos = (new tensepsilon(true, true))->setflag(status_flags::dynallocated); + static ex epsilon_neg = dynallocate(true, false); + static ex epsilon_pos = dynallocate(true, true); if (!is_a(i1) || !is_a(i2) || !is_a(i3) || !is_a(i4)) throw(std::invalid_argument("indices of Lorentz epsilon tensor must be of type varidx"));