v0.8.3
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_pointer.hpp>

Collaboration diagram for FTensor::Tensor2_symmetric< T *, Tensor_Dim >:
[legend]

Public Member Functions

template<class... U>
 Tensor2_symmetric (U *... d)
 
 Tensor2_symmetric ()
 
 Tensor2_symmetric (T *d00, T *d01, T *d11, const int i=1)
 
 Tensor2_symmetric (T *d00, T *d01, T *d02, T *d11, T *d12, T *d22, const int i=1)
 
T & operator() (const int N1, const int N2)
 
operator() (const int N1, const int N2) const
 
T * ptr (const int N1, const int N2) const
 
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr< Tensor2_symmetric< T *, Tensor_Dim >, T, Dim0, Dim1, i, j > operator() (const Index< i, Dim0 > index1, const Index< j, Dim1 > index2)
 
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr< const Tensor2_symmetric< T *, Tensor_Dim >, T, Dim0, Dim1, i, j > operator() (const Index< i, Dim0 > index1, const Index< j, Dim1 > index2) const
 
template<char i, char j, int Dim>
Tensor2_symmetric_Expr< Tensor2_symmetric< T *, Tensor_Dim >, T, Dim, i, j > operator() (const Index< i, Dim > index1, const Index< j, Dim > index2)
 
template<char i, char j, int Dim>
Tensor2_symmetric_Expr< const Tensor2_symmetric< T *, Tensor_Dim >, T, Dim, i, j > operator() (const Index< i, Dim > index1, const Index< j, Dim > index2) const
 
template<char i, int N, int Dim>
Tensor1_Expr< Tensor2_number_rhs_1< Tensor2_symmetric< T *, Tensor_Dim >, T, N >, T, Dim, i > operator() (const Index< i, Dim > index1, const Number< N > &n1)
 
template<char i, int N, int Dim>
Tensor1_Expr< const Tensor2_number_1< const Tensor2_symmetric< T *, Tensor_Dim >, T, N >, T, Dim, i > operator() (const Index< i, Dim > index1, const Number< N > &n1) const
 
template<char i, int N, int Dim>
Tensor1_Expr< Tensor2_number_rhs_0< Tensor2_symmetric< T *, Tensor_Dim >, T, N >, T, Dim, i > operator() (const Number< N > &n1, const Index< i, Dim > index1)
 
template<char i, int N, int Dim>
Tensor1_Expr< const Tensor2_number_0< const Tensor2_symmetric< T *, Tensor_Dim >, T, N >, T, Dim, i > operator() (const Number< N > &n1, const Index< i, Dim > index1) const
 
template<char i, int Dim>
Tensor1_Expr< const Tensor2_numeral_1< const Tensor2_symmetric< T *, Tensor_Dim >, T >, T, Dim, i > operator() (const Index< i, Dim > index1, const int N) const
 
template<char i, int Dim>
Tensor1_Expr< const Tensor2_numeral_0< const Tensor2_symmetric< T *, Tensor_Dim >, T >, T, Dim, i > operator() (const int N, const Index< i, Dim > index1) const
 
const Tensor2_symmetric< T *, Tensor_Dim > & operator++ () const
 
template<char i, int Dim>
operator() (const Index< i, Dim > index1, const Index< i, Dim > index2)
 
template<char i, int Dim>
operator() (const Index< i, Dim > index1, const Index< i, Dim > index2) const
 

Private Member Functions

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

Private Attributes

const int inc
 
T *restrict 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 7 of file Tensor2_symmetric_pointer.hpp.

Constructor & Destructor Documentation

◆ Tensor2_symmetric() [1/4]

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

Definition at line 13 of file Tensor2_symmetric_pointer.hpp.

13  : data{d...}
14  {
15  static_assert(sizeof...(d) == sizeof(data) / sizeof(T),
16  "Incorrect number of Arguments. Constructor should "
17  "initialize the entire Tensor");
18  }
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 *restrict data[(Tensor_Dim *(Tensor_Dim+1))/2]

◆ Tensor2_symmetric() [2/4]

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

Definition at line 20 of file Tensor2_symmetric_pointer.hpp.

20 {}

◆ Tensor2_symmetric() [3/4]

template<class T , int Tensor_Dim>
FTensor::Tensor2_symmetric< T *, Tensor_Dim >::Tensor2_symmetric ( T *  d00,
T *  d01,
T *  d11,
const int  i = 1 
)

Definition at line 23 of file Tensor2_symmetric_pointer.hpp.

23  : inc(i)
24  {
25  Tensor2_symmetric_constructor<T * restrict, Tensor_Dim>(data, d00, d01,
26  d11);
27  }
T *restrict data[(Tensor_Dim *(Tensor_Dim+1))/2]

◆ Tensor2_symmetric() [4/4]

template<class T , int Tensor_Dim>
FTensor::Tensor2_symmetric< T *, Tensor_Dim >::Tensor2_symmetric ( T *  d00,
T *  d01,
T *  d02,
T *  d11,
T *  d12,
T *  d22,
const int  i = 1 
)

Definition at line 30 of file Tensor2_symmetric_pointer.hpp.

32  : inc(i) {
33  Tensor2_symmetric_constructor<T * restrict, Tensor_Dim>(
34  data, d00, d01, d02, d11, d12, d22);
35  }
T *restrict data[(Tensor_Dim *(Tensor_Dim+1))/2]

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 ( Number< N ) const
private

Definition at line 230 of file Tensor2_symmetric_pointer.hpp.

231  {
232  return *data[N - 1 + ((N - 1) * (2 * Tensor_Dim - N)) / 2]
233  + internal_contract(Number<N - 1>());
234  }
T *restrict data[(Tensor_Dim *(Tensor_Dim+1))/2]
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 ( Number< 1 >  ) const
private

Definition at line 236 of file Tensor2_symmetric_pointer.hpp.

236 { return *data[0]; }
T *restrict 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 40 of file Tensor2_symmetric_pointer.hpp.

41  {
42 #ifdef FTENSOR_DEBUG
43  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
44  {
45  std::stringstream s;
46  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim
47  << ">.operator(" << N1 << "," << N2 << ")" << std::endl;
48  throw std::out_of_range(s.str());
49  }
50 #endif
51  return N1 > N2 ? *data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
52  : *data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
53  }
T *restrict 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 55 of file Tensor2_symmetric_pointer.hpp.

56  {
57 #ifdef FTENSOR_DEBUG
58  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
59  {
60  std::stringstream s;
61  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim
62  << ">.operator(" << N1 << "," << N2 << ") const" << std::endl;
63  throw std::out_of_range(s.str());
64  }
65 #endif
66  return N1 > N2 ? *data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
67  : *data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
68  }
T *restrict 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>
Tensor2_Expr<Tensor2_symmetric<T *, Tensor_Dim>, T, Dim0, Dim1, i, j> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim0 >  index1,
const Index< j, Dim1 >  index2 
)

Definition at line 95 of file Tensor2_symmetric_pointer.hpp.

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

◆ operator()() [4/14]

template<class T , int Tensor_Dim>
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr<const Tensor2_symmetric<T *, Tensor_Dim>, T, Dim0, Dim1, i, j> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim0 >  index1,
const Index< j, Dim1 >  index2 
) const

Definition at line 103 of file Tensor2_symmetric_pointer.hpp.

104  {
105  return Tensor2_Expr<const Tensor2_symmetric<T *, Tensor_Dim>, T, Dim0,
106  Dim1, i, j>(*this);
107  }

◆ operator()() [5/14]

template<class T , int Tensor_Dim>
template<char i, char j, int Dim>
Tensor2_symmetric_Expr<Tensor2_symmetric<T *, Tensor_Dim>, T, Dim, i, j> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Index< j, Dim >  index2 
)

Definition at line 114 of file Tensor2_symmetric_pointer.hpp.

115  {
116  return Tensor2_symmetric_Expr<Tensor2_symmetric<T *, Tensor_Dim>, T, Dim,
117  i, j>(*this);
118  }

◆ operator()() [6/14]

template<class T , int Tensor_Dim>
template<char i, char j, int Dim>
Tensor2_symmetric_Expr<const Tensor2_symmetric<T *, Tensor_Dim>, T, Dim, i, j> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Index< j, Dim >  index2 
) const

Definition at line 123 of file Tensor2_symmetric_pointer.hpp.

124  {
125  return Tensor2_symmetric_Expr<const Tensor2_symmetric<T *, Tensor_Dim>,
126  T, Dim, i, j>(*this);
127  }

◆ operator()() [7/14]

template<class T , int Tensor_Dim>
template<char i, int N, int Dim>
Tensor1_Expr<Tensor2_number_rhs_1<Tensor2_symmetric<T *, Tensor_Dim>, T, N>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Number< N > &  n1 
)

Definition at line 139 of file Tensor2_symmetric_pointer.hpp.

140  {
141  using TensorExpr
142  = Tensor2_number_rhs_1<Tensor2_symmetric<T *, Tensor_Dim>, T, N>;
144  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [8/14]

template<class T , int Tensor_Dim>
template<char i, int N, int Dim>
Tensor1_Expr< const Tensor2_number_1<const Tensor2_symmetric<T *, Tensor_Dim>, T, N>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Number< N > &  n1 
) const

Definition at line 150 of file Tensor2_symmetric_pointer.hpp.

151  {
152  using TensorExpr
153  = Tensor2_number_1<const Tensor2_symmetric<T *, Tensor_Dim>, T, N>;
154  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
155  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [9/14]

template<class T , int Tensor_Dim>
template<char i, int N, int Dim>
Tensor1_Expr<Tensor2_number_rhs_0<Tensor2_symmetric<T *, Tensor_Dim>, T, N>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Number< N > &  n1,
const Index< i, Dim >  index1 
)

Definition at line 160 of file Tensor2_symmetric_pointer.hpp.

161  {
162  using TensorExpr
163  = Tensor2_number_rhs_0<Tensor2_symmetric<T *, Tensor_Dim>, T, N>;
165  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [10/14]

template<class T , int Tensor_Dim>
template<char i, int N, int Dim>
Tensor1_Expr< const Tensor2_number_0<const Tensor2_symmetric<T *, Tensor_Dim>, T, N>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Number< N > &  n1,
const Index< i, Dim >  index1 
) const

Definition at line 171 of file Tensor2_symmetric_pointer.hpp.

172  {
173  using TensorExpr
174  = Tensor2_number_0<const Tensor2_symmetric<T *, Tensor_Dim>, T, N>;
175  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
176  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [11/14]

template<class T , int Tensor_Dim>
template<char i, int Dim>
Tensor1_Expr< const Tensor2_numeral_1<const Tensor2_symmetric<T *, Tensor_Dim>, T>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const int  N 
) const

Definition at line 184 of file Tensor2_symmetric_pointer.hpp.

185  {
186  using TensorExpr
187  = Tensor2_numeral_1<const Tensor2_symmetric<T *, Tensor_Dim>, T>;
188  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
189  }

◆ operator()() [12/14]

template<class T , int Tensor_Dim>
template<char i, int Dim>
Tensor1_Expr< const Tensor2_numeral_0<const Tensor2_symmetric<T *, Tensor_Dim>, T>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const int  N,
const Index< i, Dim >  index1 
) const

Definition at line 195 of file Tensor2_symmetric_pointer.hpp.

196  {
197  using TensorExpr
198  = Tensor2_numeral_0<const Tensor2_symmetric<T *, Tensor_Dim>, T>;
199  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
200  }

◆ operator()() [13/14]

template<class T , int Tensor_Dim>
template<char i, int Dim>
T FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Index< i, Dim >  index2 
)

Definition at line 218 of file Tensor2_symmetric_pointer.hpp.

219  {
220  return internal_contract(Number<Dim>());
221  }

◆ operator()() [14/14]

template<class T , int Tensor_Dim>
template<char i, int Dim>
T FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Index< i, Dim >  index2 
) const

Definition at line 224 of file Tensor2_symmetric_pointer.hpp.

225  {
226  return internal_contract(Number<Dim>());
227  }

◆ operator++()

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

Definition at line 205 of file Tensor2_symmetric_pointer.hpp.

206  {
207  for(int i = 0; i < (Tensor_Dim * (Tensor_Dim + 1)) / 2; ++i)
208  data[i] += inc;
209  return *this;
210  }
T *restrict data[(Tensor_Dim *(Tensor_Dim+1))/2]

◆ ptr()

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

Definition at line 70 of file Tensor2_symmetric_pointer.hpp.

71  {
72 #ifdef FTENSOR_DEBUG
73  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
74  {
75  std::stringstream s;
76  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim << ">.ptr("
77  << N1 << "," << N2 << ")" << std::endl;
78  throw std::out_of_range(s.str());
79  }
80 #endif
81  return N1 > N2 ? data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
82  : data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
83  }
T *restrict data[(Tensor_Dim *(Tensor_Dim+1))/2]

Member Data Documentation

◆ data

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

Definition at line 10 of file Tensor2_symmetric_pointer.hpp.

◆ inc

template<class T , int Tensor_Dim>
const int FTensor::Tensor2_symmetric< T *, Tensor_Dim >::inc
private

Definition at line 9 of file Tensor2_symmetric_pointer.hpp.


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