[LORENE] Traces and contractions of tensors

Eric Gourgoulhon Eric.Gourgoulhon at obspm.fr
Wed Feb 18 20:27:40 CET 2004


Dear all,

New methods have been introduced in class Tensor,
to take the trace :

1/ Tensor Tensor::trace(int ind1, int ind2) const

2/ Tensor Tensor::trace(int ind1, int ind2, const Metric& gam) const

3/ Scalar Tensor::trace() const

4/ Scalar Tensor::trace(const Metric& gam) const

Method 1/ takes the trace by making a summation onto the
two indices ind1 and ind2, which must be of different
type (i.e. one must be covariant and the other contravariant).

Method 2/ takes the trace when the two indices are of the
same type, by raising or lowering the first one
with the provided metric.

Method 3/ and 4/ are for tensor of valence 2 only (hence
the indices are not specified).

Note that method 1/ is identical to the previous method
Tensor::scontract. Therefore, this latter has been
suppressed. If you used it, all you have to do is
simply to replace each occurence of "scontract" in your
code by "trace". Sorry for the inconvenience...

Besides, a new external (i.e. not member of class Tensor)
function has been introduced:

Tensor contract(const Tensor& t1, int ind_i1, int ind_j1,
                const Tensor& t2, int ind_i2, int ind_j2,
                bool desaliasing = false)

to perform a double contraction on two tensors,
i.e. to compute things like K_{ij} K^{ij}.

Bon code !

    Eric.

-- 
Eric Gourgoulhon
Laboratoire de l'Univers et de ses THeories (LUTH)
UMR 8102 du CNRS / Observatoire de Paris, F-92195 Meudon Cedex, France
tel: +33 1.45.07.74.33 (secretariat : +33 1.45.07.75.10)
e-mail: Eric.Gourgoulhon/at/obspm.fr    WWW: http://www.luth.obspm.fr/





More information about the Lorene.list mailing list