Tensor calculus
Tensorial fields

() More...

## Functions

Tensor | Lorene::operator* (const Tensor &a, const Tensor &b)
| Tensorial product.
Tensor_sym | Lorene::operator* (const Tensor &a, const Tensor_sym &b)
| Tensorial product with symmetries.
Tensor_sym | Lorene::operator* (const Tensor_sym &a, const Tensor &b)
| Tensorial product with symmetries.
Tensor_sym | Lorene::operator* (const Tensor_sym &a, const Tensor_sym &b)
| Tensorial product of two symmetric tensors.
Tensor | Lorene::contract (const Tensor &t1, int ind1, const Tensor &t2, int ind2, bool desaliasing=false)
| Contraction of two tensors.
Tensor | Lorene::contract (const Tensor &t1, int ind_i1, int ind_j1, const Tensor &t2, int ind_i2, int ind_j2, bool desaliasing=false)
| Double contraction of two tensors.
Tensor | Lorene::contract (const Tensor &t1, int ind1, int ind2)
| Contraction on two indices of a single tensor (trace).
Tbl | Lorene::max (const Tensor &aa, const char *comment=0x0, ostream &ost=cout)
| Maxima in each domain of the values of the tensor components.
Tbl | Lorene::min (const Tensor &aa, const char *comment=0x0, ostream &ost=cout)
| Minima in each domain of the values of the tensor components.
Tbl | Lorene::maxabs (const Tensor &aa, const char *comment=0x0, ostream &ost=cout, bool verb=true)
| Maxima in each domain of the absolute values of the tensor components.
Tbl | Lorene::diffrel (const Tensor &aa, const Tensor &bb, const char *comment=0x0, ostream &ost=cout)
| Relative difference between two `Tensor` ( version).
Tbl | Lorene::diffrelmax (const Tensor &aa, const Tensor &bb, const char *comment=0x0, ostream &ost=cout)
| Relative difference between two `Tensor` (max version).
Tbl | Lorene::central_value (const Tensor &aa, const char *comment=0x0, ostream &ost=cout)
| Central value of each component of a tensor.
Tbl | Lorene::max_all_domains (const Tensor &aa, int l_excluded=-1, const char *comment=0x0, ostream &ost=cout)
| Maximum value of each component of a tensor over all the domains.
Tbl | Lorene::min_all_domains (const Tensor &aa, int l_excluded=-1, const char *comment=0x0, ostream &ost=cout)
| Minimum value of each component of a tensor over all the domains.
Tbl | Lorene::maxabs_all_domains (const Tensor &aa, int l_excluded=-1, const char *comment=0x0, ostream &ost=cout, bool verb=true)
| Maximum of the absolute value of each component of a tensor over all the domains.

## Detailed Description

()

## Function Documentation

## central_value()

Tbl Lorene::central_value | ( | const Tensor & | aa,
|  | const char * | comment = 0x0,
|  | ostream & | ost = cout )

Central value of each component of a tensor.

Parameters

  aa | tensor
  comment | comment to be printed on `ost` (default: 0x0 = nothing printed)
  ost | output stream for a formatted output of the result; used only if `comment` != `0x0`.

Returns
  1-D `Tbl` of size the number of independent components (`aa.get_ncomp()`), the elements of which are the central values of the various components.

Definition at line 649 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

## contract() [1/3]

Tensor Lorene::contract | ( | const Tensor & | t1,
|  | int | ind1,
|  | const Tensor & | t2,
|  | int | ind2,
|  | bool | desaliasing = false )

Contraction of two tensors.

Parameters

  t1 | [input] first tensor

  ind1

  [input] index of the first tensor for the contraction, obeying to the following convention :
  - `ind1` = 0 : first index of the tensor
  - `ind1` = 1 : second index of the tensor
  - and so on... (`ind1` must thus be in the range 0...t1.valence-1)

  t2 | [input] second tensor
  ind2 | [input] index of the second tensor for the contraction, with the same convention as `ind1`
  desaliasing | [input] determines whether the products are performed with desaliasing or not

Returns
  tensor resulting of the contraction of the index `ind1` of `t1` with the index `ind2` of `t2` . NB: the types (`COV` or `CON` ) of the indices `ind1` and `ind2` must be different.

Definition at line 160 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_index_type(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_triad(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::Itbl::set(), Lorene::Tensor::set(), and Lorene::Scalar::set_etat_zero().

## contract() [2/3]

Tensor Lorene::contract | ( | const Tensor & | t1,
|  | int | ind1,
|  | int | ind2 )

Contraction on two indices of a single tensor (trace).

Parameters

  t1 | [input] tensor

  ind1

  [input] first index of the tensor for the contraction, obeying to the following convention :
  - `ind1` = 0 : first index of the tensor
  - `ind1` = 1 : second index of the tensor
  - and so on... (`ind1` must thus be in the range 0...t1.valence-1)

  ind2 | [input] second index of the tensor for the contraction, with the same convention as `ind1`

Returns
  tensor resulting of the contraction NB: the types (`COV` or `CON` ) of the indices `ind1` and `ind2` must be different.

Definition at line 340 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_index_type(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_triad(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::Itbl::set(), Lorene::Tensor::set(), and Lorene::Scalar::set_etat_zero().

## contract() [3/3]

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

Double contraction of two tensors.

Parameters

  t1 | [input] first tensor

  ind_i1

  [input] position of the first index i1 in the first tensor for the contraction, obeying to the following convention :
  - `ind_i1` = 0 : first index of the tensor
  - `ind_i1` = 1 : second index of the tensor
  - and so on... (`ind_i1` must thus be in the range 0...t1.valence-1)

  ind_j1 | [input] position of the second index j1 in the first tensor for the contraction; one must have `ind_i1` < `ind_` j1
  t2 | [input] second tensor
  ind_i2 | [input] position of the first index i2 in the second tensor for the contraction
  ind_j2 | [input] position of the second index j2 in the second tensor for the contraction; one must have `ind_i2` < `ind_` j2
  desaliasing | [input] determines whether the products are performed with desaliasing or not

Returns
  tensor resulting of the contraction of the index `ind_i1`
  of `t1` with the index `ind_i2` of `t2` and of the contraction of the index `ind_j1`
  of `t1` with the index `ind_j2` of `t2` NB: the types (`COV` or `CON` ) of the indices `ind_i1` and `ind_i2` (resp. `ind_j1` and `ind_j2` ) must be different.

Definition at line 238 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_index_type(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_triad(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::Itbl::set(), Lorene::Tensor::set(), and Lorene::Scalar::set_etat_zero().

## diffrel()

Tbl Lorene::diffrel | ( | const Tensor & | aa,
|  | const Tensor & | bb,
|  | const char * | comment = 0x0,
|  | ostream & | ost = cout )

Relative difference between two `Tensor` ( version).

Parameters

  aa | first tensor
  bb | second tensor
  comment | comment to be printed on `ost` before the result (default: 0x0 = nothing printed)
  ost | output stream for a formatted output of the result

Returns
  2-D `Tbl` of size the number of independent components times the number of domains, the elements ``(i,l) of which are `norme`[a(l)-b(l)]/norme[b(l)] if `b(l)!=0` and `norme`[a(l)-b(l)] if `b(l)=0` , where `a(l)` and `b(l)` denote symbolically the values of `aa` and `bb`
  in domain no. `l` and for component no.`i` .

Definition at line 408 of file tensor_calculus_ext.C.

References diffrel(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

## diffrelmax()

Tbl Lorene::diffrelmax | ( | const Tensor & | aa,
|  | const Tensor & | bb,
|  | const char * | comment = 0x0,
|  | ostream & | ost = cout )

Relative difference between two `Tensor` (max version).

Parameters

  aa | first tensor
  bb | second tensor
  comment | comment to be printed on `ost` before the result (default: 0x0 = nothing printed)
  ost | output stream for a formatted output of the result

Returns
  2-D `Tbl` of size the number of independent components times the number of domains, the elements ``(i,l) of which are `max`[abs(a(l)-b(l))]/max[abs(b(l))] if `b(l)!=0` and `max`[abs(a(l)-b(l))] if `b(l)=0` , where `a(l)` and `b(l)` denote symbolically the values of `aa` and `bb`
  in domain no. `l` and for component no.`i` .

Definition at line 464 of file tensor_calculus_ext.C.

References diffrelmax(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

## max()

Tbl Lorene::max | ( | const Tensor & | aa,
|  | const char * | comment = 0x0,
|  | ostream & | ost = cout )

Maxima in each domain of the values of the tensor components.

Parameters

  aa | tensor
  comment | comment to be printed on `ost` before the result (default: 0x0 = nothing printed)
  ost | output stream for a formatted output of the result

Returns
  2-D `Tbl` of size the number of independent components times the number of domains, the elements ``(i,l) of which are `max(a(l))` , where `a(l)`
  denotes symbolically the values of `aa`
  in domain no. `l` and for component no.`i` .

Definition at line 521 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), max(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

## max_all_domains()

Tbl Lorene::max_all_domains | ( | const Tensor & | aa,
|  | int | l_excluded = -1,
|  | const char * | comment = 0x0,
|  | ostream & | ost = cout )

Maximum value of each component of a tensor over all the domains.

Parameters

  aa | tensor
  l_excluded | index of domain to be excluded from the computation: the default = -1 corresponds to no excluded domain
  comment | comment to be printed on `ost` (default: 0x0 = nothing printed)
  ost | output stream for a formatted output of the result; used only if `comment` != `0x0`.

Returns
  1-D `Tbl` of size the number of independent components (`aa.get_ncomp()`), the elements of which are the maximum values of the various components.

Definition at line 687 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), max(), Lorene::Tbl::set(), Lorene::Tbl::set_etat_qcq(), and x.

## maxabs()

Tbl Lorene::maxabs | ( | const Tensor & | aa,
|  | const char * | comment = 0x0,
|  | ostream & | ost = cout,
|  | bool | verb = true )

Maxima in each domain of the absolute values of the tensor components.

Parameters

  aa | tensor
  comment | comment to be printed on `ost` before the result (default: 0x0 = nothing printed)
  ost | output stream for a formatted output of the result

Returns
  2-D `Tbl` of size the number of independent components times the number of domains, the elements ``(i,l) of which are `max`[abs(a(l))] , where `a(l)`
  denotes symbolically the values of `aa`
  in domain no. `l` and for component no.`i` .

Definition at line 606 of file tensor_calculus_ext.C.

References abs(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), max(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

## maxabs_all_domains()

Tbl Lorene::maxabs_all_domains | ( | const Tensor & | aa,
|  | int | l_excluded = -1,
|  | const char * | comment = 0x0,
|  | ostream & | ost = cout,
|  | bool | verb = true )

Maximum of the absolute value of each component of a tensor over all the domains.

Parameters

  aa | tensor
  l_excluded | index of domain to be excluded from the computation: the default = -1 corresponds to no excluded domain
  comment | comment to be printed on `ost` (default: 0x0 = nothing printed)
  ost | output stream for a formatted output of the result; used only if `comment` != `0x0`.

Returns
  1-D `Tbl` of size the number of independent components (`aa.get_ncomp()`), the elements of which are the maximum of of the absolute value of the various components.

Definition at line 788 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), maxabs(), Lorene::Tbl::set(), Lorene::Tbl::set_etat_qcq(), and x.

## min()

Tbl Lorene::min | ( | const Tensor & | aa,
|  | const char * | comment = 0x0,
|  | ostream & | ost = cout )

Minima in each domain of the values of the tensor components.

Parameters

  aa | tensor
  comment | comment to be printed on `ost` before the result (default: 0x0 = nothing printed)
  ost | output stream for a formatted output of the result

Returns
  2-D `Tbl` of size the number of independent components times the number of domains, the elements ``(i,l) of which are `min(a(l))`, where `a(l)`
  denotes symbolically the values of `aa`
  in domain no. `l` and for component no.`i` .

Definition at line 564 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), min(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

## min_all_domains()

Tbl Lorene::min_all_domains | ( | const Tensor & | aa,
|  | int | l_excluded = -1,
|  | const char * | comment = 0x0,
|  | ostream & | ost = cout )

Minimum value of each component of a tensor over all the domains.

Parameters

  aa | tensor
  l_excluded | index of domain to be excluded from the computation: the default = -1 corresponds to no excluded domain
  comment | comment to be printed on `ost` (default: 0x0 = nothing printed)
  ost | output stream for a formatted output of the result; used only if `comment` != `0x0`.

Returns
  1-D `Tbl` of size the number of independent components (`aa.get_ncomp()`), the elements of which are the minimum values of the various components.

Definition at line 737 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), min(), Lorene::Tbl::set(), Lorene::Tbl::set_etat_qcq(), and x.

## operator*() [1/4]

Tensor Lorene::operator* | ( | const Tensor & | a,
|  | const Tensor & | b )

Tensorial product.

Definition at line 107 of file tensor_calculus_ext.C.

## operator*() [2/4]

Tensor_sym Lorene::operator* | ( | const Tensor & | a,
|  | const Tensor_sym & | b )

Tensorial product with symmetries.

Definition at line 108 of file tensor_sym_calculus.C.

## operator*() [3/4]

Tensor_sym Lorene::operator* | ( | const Tensor_sym & | a,
|  | const Tensor & | b )

Tensorial product with symmetries.

Definition at line 68 of file tensor_sym_calculus.C.

## operator*() [4/4]

Tensor_sym Lorene::operator* | ( | const Tensor_sym & | a,
|  | const Tensor_sym & | b )

Tensorial product of two symmetric tensors.

NB: the output is an object of class `Tensor_sym` , with the two symmetric indices corresponding to the symmetric indices of tensor `a` . This means that the symmetries of tensor `b` indices are not used in the storage, since there is currently no class in Lorene to manage tensors with more than two symmetric indices.

Definition at line 151 of file tensor_sym_calculus.C.