v0.8.13
Public Member Functions | Private Member Functions | Private Attributes | List of all members
FTensor::Tensor2_symmetric< T, Tensor_Dim > Class Template Reference

#include <src/ftensor/src/FTensor/Tensor2_symmetric/Tensor2_symmetric_value.hpp>

Public Member Functions

template<class... U>
 Tensor2_symmetric (U... d)
 
 Tensor2_symmetric ()
 
Toperator() (const int N1, const int N2)
 
T operator() (const int N1, const int N2) const
 
template<char i, char j, int Dim0, int Dim1>
std::enable_if<(Tensor_Dim >=Dim0 &&Tensor_Dim >=Dim1), Tensor2_Expr< Tensor2_symmetric< T, Tensor_Dim >, T, Dim0, Dim1, i, j > >::type operator() (const Index< i, Dim0 >, const Index< j, Dim1 >)
 
template<char i, char j, int Dim0, int Dim1>
std::enable_if<(Tensor_Dim >=Dim0 &&Tensor_Dim >=Dim1), Tensor2_Expr< const Tensor2_symmetric< T, Tensor_Dim >, T, Dim0, Dim1, i, j > >::type operator() (const Index< i, Dim0 >, const Index< j, Dim1 >) const
 
template<char i, char j, int Dim>
std::enable_if<(Tensor_Dim >=Dim), Tensor2_symmetric_Expr< Tensor2_symmetric< T, Tensor_Dim >, T, Dim, i, j > >::type operator() (const Index< i, Dim >, const Index< j, Dim >)
 
template<char i, char j, int Dim>
std::enable_if<(Tensor_Dim >=Dim), Tensor2_symmetric_Expr< const Tensor2_symmetric< T, Tensor_Dim >, T, Dim, i, j > >::type operator() (const Index< i, Dim >, const Index< j, Dim >) const
 
template<char i, int N, int Dim>
std::enable_if<(Tensor_Dim >=Dim &&Tensor_Dim > N), Tensor1_Expr< Tensor2_number_rhs_1< Tensor2_symmetric< T, Tensor_Dim >, T, N >, T, Dim, i > >::type operator() (const Index< i, Dim >, const Number< N > &)
 
template<char i, int N, int Dim>
std::enable_if<(Tensor_Dim >=Dim &&Tensor_Dim > N), Tensor1_Expr< Tensor2_number_1< const Tensor2_symmetric< T, Tensor_Dim >, T, N >, T, Dim, i > >::type operator() (const Index< i, Dim >, const Number< N > &) const
 
template<char i, int N, int Dim>
std::enable_if<(Tensor_Dim > N &&Tensor_Dim >=Dim), Tensor1_Expr< Tensor2_number_rhs_0< Tensor2_symmetric< T, Tensor_Dim >, T, N >, T, Dim, i > >::type operator() (const Number< N > &, const Index< i, Dim >)
 
template<char i, int N, int Dim>
std::enable_if<(Tensor_Dim > N &&Tensor_Dim >=Dim), Tensor1_Expr< Tensor2_number_0< const Tensor2_symmetric< T, Tensor_Dim >, T, N >, T, Dim, i > >::type operator() (const Number< N > &, const Index< i, Dim >) const
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim >=Dim), Tensor1_Expr< Tensor2_numeral_1< const Tensor2_symmetric< T, Tensor_Dim >, T >, T, Dim, i > >::type operator() (const Index< i, Dim >, const int N) const
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim >=Dim), Tensor1_Expr< Tensor2_numeral_0< const Tensor2_symmetric< T, Tensor_Dim >, T >, T, Dim, i > >::type operator() (const int N, const Index< i, Dim >) const
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim >=Dim), T >::type operator() (const Index< i, Dim >, const Index< i, Dim >)
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim >=Dim), T >::type operator() (const Index< i, Dim >, const Index< i, Dim >) const
 

Private Member Functions

template<int N>
T internal_contract (const Number< N > &) const
 
T internal_contract (const Number< 1 > &) const
 

Private Attributes

T data [(Tensor_Dim *(Tensor_Dim+1))/2]
 

Detailed Description

template<class T, int Tensor_Dim>
class FTensor::Tensor2_symmetric< T, Tensor_Dim >

Definition at line 13 of file Tensor2_symmetric_value.hpp.

Constructor & Destructor Documentation

◆ Tensor2_symmetric() [1/2]

template<class T, int Tensor_Dim>
template<class... U>
FTensor::Tensor2_symmetric< T, Tensor_Dim >::Tensor2_symmetric ( U...  d)

Definition at line 18 of file Tensor2_symmetric_value.hpp.

18  : data{d...}
19  {
20  static_assert(sizeof...(d) == sizeof(data) / sizeof(T),
21  "Incorrect number of Arguments. Constructor should "
22  "initialize the entire Tensor");
23  }
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T *> &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: dTensor0.hpp:27
T data[(Tensor_Dim *(Tensor_Dim+1))/2]

◆ Tensor2_symmetric() [2/2]

template<class T, int Tensor_Dim>
FTensor::Tensor2_symmetric< T, Tensor_Dim >::Tensor2_symmetric ( )

Definition at line 25 of file Tensor2_symmetric_value.hpp.

25 {}

Member Function Documentation

◆ internal_contract() [1/2]

template<class T, int Tensor_Dim>
template<int N>
T FTensor::Tensor2_symmetric< T, Tensor_Dim >::internal_contract ( const Number< N > &  ) const
private

Definition at line 213 of file Tensor2_symmetric_value.hpp.

214  {
215  return data[N - 1 + ((N - 1) * (2 * Tensor_Dim - N)) / 2]
216  + internal_contract(Number<N - 1>());
217  }
T data[(Tensor_Dim *(Tensor_Dim+1))/2]
T internal_contract(const Number< N > &) const
const int N
Definition: speed_test.cpp:3

◆ internal_contract() [2/2]

template<class T, int Tensor_Dim>
T FTensor::Tensor2_symmetric< T, Tensor_Dim >::internal_contract ( const Number< 1 > &  ) const
private

Definition at line 219 of file Tensor2_symmetric_value.hpp.

219 { return data[0]; }
T data[(Tensor_Dim *(Tensor_Dim+1))/2]

◆ operator()() [1/14]

template<class T, int Tensor_Dim>
T& FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const int  N1,
const int  N2 
)

Definition at line 30 of file Tensor2_symmetric_value.hpp.

31  {
32 #ifdef FTENSOR_DEBUG
33  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
34  {
35  std::stringstream s;
36  s << "Bad index in Tensor2_symmetric<T," << Tensor_Dim
37  << ">.operator(" << N1 << "," << N2 << ")" << std::endl;
38  throw std::out_of_range(s.str());
39  }
40 #endif
41  return N1 > N2 ? data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
42  : data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
43  }
T data[(Tensor_Dim *(Tensor_Dim+1))/2]

◆ operator()() [2/14]

template<class T, int Tensor_Dim>
T FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const int  N1,
const int  N2 
) const

Definition at line 45 of file Tensor2_symmetric_value.hpp.

46  {
47 #ifdef FTENSOR_DEBUG
48  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
49  {
50  std::stringstream s;
51  s << "Bad index in Tensor2_symmetric<T," << Tensor_Dim
52  << ">.operator(" << N1 << "," << N2 << ") const" << std::endl;
53  throw std::out_of_range(s.str());
54  }
55 #endif
56  return N1 > N2 ? data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
57  : data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
58  }
T data[(Tensor_Dim *(Tensor_Dim+1))/2]

◆ operator()() [3/14]

template<class T, int Tensor_Dim>
template<char i, char j, int Dim0, int Dim1>
std::enable_if< (Tensor_Dim >= Dim0 && Tensor_Dim >= Dim1), Tensor2_Expr<Tensor2_symmetric<T, Tensor_Dim>, T, Dim0, Dim1, i, j> >::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >   
)

Definition at line 72 of file Tensor2_symmetric_value.hpp.

73  {
74  return Tensor2_Expr<Tensor2_symmetric<T, Tensor_Dim>, T, Dim0, Dim1, i,
75  j>(*this);
76  }

◆ operator()() [4/14]

template<class T, int Tensor_Dim>
template<char i, char j, int Dim0, int Dim1>
std::enable_if<(Tensor_Dim >= Dim0 && Tensor_Dim >= Dim1), Tensor2_Expr<const Tensor2_symmetric<T, Tensor_Dim>, T, Dim0, Dim1, i, j> >::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >   
) const

Definition at line 82 of file Tensor2_symmetric_value.hpp.

83  {
84  return Tensor2_Expr<const Tensor2_symmetric<T, Tensor_Dim>, T, Dim0,
85  Dim1, i, j>(*this);
86  }

◆ operator()() [5/14]

template<class T, int Tensor_Dim>
template<char i, char j, int Dim>
std::enable_if< (Tensor_Dim >= Dim), Tensor2_symmetric_Expr<Tensor2_symmetric<T, Tensor_Dim>, T, Dim, i, j> >::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const Index< i, Dim >  ,
const Index< j, Dim >   
)

Definition at line 95 of file Tensor2_symmetric_value.hpp.

96  {
97  return Tensor2_symmetric_Expr<Tensor2_symmetric<T, Tensor_Dim>, T, Dim,
98  i, j>(*this);
99  }

◆ operator()() [6/14]

template<class T, int Tensor_Dim>
template<char i, char j, int Dim>
std::enable_if< (Tensor_Dim >= Dim), Tensor2_symmetric_Expr<const Tensor2_symmetric<T, Tensor_Dim>, T, Dim, i, j> >::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const Index< i, Dim >  ,
const Index< j, Dim >   
) const

Definition at line 106 of file Tensor2_symmetric_value.hpp.

107  {
108  return Tensor2_symmetric_Expr<const Tensor2_symmetric<T, Tensor_Dim>, T,
109  Dim, i, j>(*this);
110  }

◆ operator()() [7/14]

template<class T, int Tensor_Dim>
template<char i, int N, int Dim>
std::enable_if< (Tensor_Dim >= Dim && Tensor_Dim > N), Tensor1_Expr<Tensor2_number_rhs_1<Tensor2_symmetric<T, Tensor_Dim>, T, N>, T, Dim, i> >::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const Index< i, Dim >  ,
const Number< N > &   
)

Definition at line 124 of file Tensor2_symmetric_value.hpp.

125  {
126  using TensorExpr
127  = Tensor2_number_rhs_1<Tensor2_symmetric<T, Tensor_Dim>, T, N>;
129  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [8/14]

template<class T, int Tensor_Dim>
template<char i, int N, int Dim>
std::enable_if< (Tensor_Dim >= Dim && Tensor_Dim > N), Tensor1_Expr<Tensor2_number_1<const Tensor2_symmetric<T, Tensor_Dim>, T, N>, T, Dim, i> >::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const Index< i, Dim >  ,
const Number< N > &   
) const

Definition at line 136 of file Tensor2_symmetric_value.hpp.

137  {
138  using TensorExpr
139  = Tensor2_number_1<const Tensor2_symmetric<T, Tensor_Dim>, T, N>;
140  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
141  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [9/14]

template<class T, int Tensor_Dim>
template<char i, int N, int Dim>
std::enable_if< (Tensor_Dim > N && Tensor_Dim >= Dim), Tensor1_Expr<Tensor2_number_rhs_0<Tensor2_symmetric<T, Tensor_Dim>, T, N>, T, Dim, i> >::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const Number< N > &  ,
const Index< i, Dim >   
)

Definition at line 148 of file Tensor2_symmetric_value.hpp.

149  {
150  using TensorExpr
151  = Tensor2_number_rhs_0<Tensor2_symmetric<T, Tensor_Dim>, T, N>;
153  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [10/14]

template<class T, int Tensor_Dim>
template<char i, int N, int Dim>
std::enable_if< (Tensor_Dim > N && Tensor_Dim >= Dim), Tensor1_Expr<Tensor2_number_0<const Tensor2_symmetric<T, Tensor_Dim>, T, N>, T, Dim, i> >::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const Number< N > &  ,
const Index< i, Dim >   
) const

Definition at line 160 of file Tensor2_symmetric_value.hpp.

161  {
162  using TensorExpr
163  = Tensor2_number_0<const Tensor2_symmetric<T, Tensor_Dim>, T, N>;
164  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
165  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [11/14]

template<class T, int Tensor_Dim>
template<char i, int Dim>
std::enable_if< (Tensor_Dim >= Dim), Tensor1_Expr<Tensor2_numeral_1<const Tensor2_symmetric<T, Tensor_Dim>, T>, T, Dim, i> >::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const Index< i, Dim >  ,
const int  N 
) const

Definition at line 174 of file Tensor2_symmetric_value.hpp.

175  {
176  using TensorExpr
177  = Tensor2_numeral_1<const Tensor2_symmetric<T, Tensor_Dim>, T>;
178  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
179  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [12/14]

template<class T, int Tensor_Dim>
template<char i, int Dim>
std::enable_if< (Tensor_Dim >= Dim), Tensor1_Expr<Tensor2_numeral_0<const Tensor2_symmetric<T, Tensor_Dim>, T>, T, Dim, i> >::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const int  N,
const Index< i, Dim >   
) const

Definition at line 186 of file Tensor2_symmetric_value.hpp.

187  {
188  using TensorExpr
189  = Tensor2_numeral_0<const Tensor2_symmetric<T, Tensor_Dim>, T>;
190  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
191  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [13/14]

template<class T, int Tensor_Dim>
template<char i, int Dim>
std::enable_if<(Tensor_Dim >= Dim), T>::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >   
)

Definition at line 200 of file Tensor2_symmetric_value.hpp.

201  {
202  return internal_contract(Number<Dim>());
203  }
T internal_contract(const Number< N > &) const

◆ operator()() [14/14]

template<class T, int Tensor_Dim>
template<char i, int Dim>
std::enable_if<(Tensor_Dim >= Dim), T>::type FTensor::Tensor2_symmetric< T, Tensor_Dim >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >   
) const

Definition at line 207 of file Tensor2_symmetric_value.hpp.

208  {
209  return internal_contract(Number<Dim>());
210  }
T internal_contract(const Number< N > &) const

Member Data Documentation

◆ data

template<class T, int Tensor_Dim>
T FTensor::Tensor2_symmetric< T, Tensor_Dim >::data[(Tensor_Dim *(Tensor_Dim+1))/2]
private

Definition at line 15 of file Tensor2_symmetric_value.hpp.


The documentation for this class was generated from the following file: