v0.8.13
Public Member Functions | Protected Attributes | 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>

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

Public Member Functions

template<class... U>
 Tensor2_symmetric (U *... d)
 
template<class... U>
 Tensor2_symmetric (const int i, 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)
 
Toperator() (const int N1, const int N2)
 
T operator() (const int N1, const int N2) const
 
Tptr (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>
T operator() (const Index< i, Dim > index1, const Index< i, Dim > index2)
 
template<char i, int Dim>
T operator() (const Index< i, Dim > index1, const Index< i, Dim > index2) const
 

Protected Attributes

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

Private Member Functions

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

Private Attributes

const int inc
 

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/5]

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

Definition at line 17 of file Tensor2_symmetric_pointer.hpp.

17  : data{d...}, inc(1) {
18  static_assert(sizeof...(d) == sizeof(data) / sizeof(T),
19  "Incorrect number of Arguments. Constructor should "
20  "initialize the entire Tensor");
21  }
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/5]

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

Definition at line 24 of file Tensor2_symmetric_pointer.hpp.

24  : data{d...}, inc(i) {
25  static_assert(sizeof...(d) == sizeof(data) / sizeof(T),
26  "Incorrect number of Arguments. Constructor should "
27  "initialize the entire Tensor");
28  }
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() [3/5]

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

Definition at line 30 of file Tensor2_symmetric_pointer.hpp.

30 {}

◆ Tensor2_symmetric() [4/5]

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 33 of file Tensor2_symmetric_pointer.hpp.

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

◆ Tensor2_symmetric() [5/5]

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 40 of file Tensor2_symmetric_pointer.hpp.

42  : inc(i) {
43  Tensor2_symmetric_constructor<T * restrict, Tensor_Dim>(
44  data, d00, d01, d02, d11, d12, d22);
45  }
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 240 of file Tensor2_symmetric_pointer.hpp.

241  {
242  return *data[N - 1 + ((N - 1) * (2 * Tensor_Dim - N)) / 2]
243  + internal_contract(Number<N - 1>());
244  }
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 246 of file Tensor2_symmetric_pointer.hpp.

246 { 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 50 of file Tensor2_symmetric_pointer.hpp.

51  {
52 #ifdef FTENSOR_DEBUG
53  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
54  {
55  std::stringstream s;
56  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim
57  << ">.operator(" << N1 << "," << N2 << ")" << std::endl;
58  throw std::out_of_range(s.str());
59  }
60 #endif
61  return N1 > N2 ? *data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
62  : *data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
63  }
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 65 of file Tensor2_symmetric_pointer.hpp.

66  {
67 #ifdef FTENSOR_DEBUG
68  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
69  {
70  std::stringstream s;
71  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim
72  << ">.operator(" << N1 << "," << N2 << ") const" << std::endl;
73  throw std::out_of_range(s.str());
74  }
75 #endif
76  return N1 > N2 ? *data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
77  : *data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
78  }
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 105 of file Tensor2_symmetric_pointer.hpp.

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

◆ 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 113 of file Tensor2_symmetric_pointer.hpp.

114  {
115  return Tensor2_Expr<const Tensor2_symmetric<T *, Tensor_Dim>, T, Dim0,
116  Dim1, i, j>(*this);
117  }

◆ 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 124 of file Tensor2_symmetric_pointer.hpp.

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

◆ 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 133 of file Tensor2_symmetric_pointer.hpp.

134  {
135  return Tensor2_symmetric_Expr<const Tensor2_symmetric<T *, Tensor_Dim>,
136  T, Dim, i, j>(*this);
137  }

◆ 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 149 of file Tensor2_symmetric_pointer.hpp.

150  {
151  using TensorExpr
152  = Tensor2_number_rhs_1<Tensor2_symmetric<T *, Tensor_Dim>, T, N>;
154  }
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 160 of file Tensor2_symmetric_pointer.hpp.

161  {
162  using TensorExpr
163  = Tensor2_number_1<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()() [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 170 of file Tensor2_symmetric_pointer.hpp.

171  {
172  using TensorExpr
173  = Tensor2_number_rhs_0<Tensor2_symmetric<T *, Tensor_Dim>, T, N>;
175  }
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 181 of file Tensor2_symmetric_pointer.hpp.

182  {
183  using TensorExpr
184  = Tensor2_number_0<const Tensor2_symmetric<T *, Tensor_Dim>, T, N>;
185  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
186  }
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 194 of file Tensor2_symmetric_pointer.hpp.

195  {
196  using TensorExpr
197  = Tensor2_numeral_1<const Tensor2_symmetric<T *, Tensor_Dim>, T>;
198  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
199  }
const int N
Definition: speed_test.cpp:3

◆ 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 205 of file Tensor2_symmetric_pointer.hpp.

206  {
207  using TensorExpr
208  = Tensor2_numeral_0<const Tensor2_symmetric<T *, Tensor_Dim>, T>;
209  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
210  }
const int N
Definition: speed_test.cpp:3

◆ 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 228 of file Tensor2_symmetric_pointer.hpp.

229  {
230  return internal_contract(Number<Dim>());
231  }

◆ 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 234 of file Tensor2_symmetric_pointer.hpp.

235  {
236  return internal_contract(Number<Dim>());
237  }

◆ operator++()

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

Definition at line 215 of file Tensor2_symmetric_pointer.hpp.

216  {
217  for(int i = 0; i < (Tensor_Dim * (Tensor_Dim + 1)) / 2; ++i)
218  data[i] += inc;
219  return *this;
220  }
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 80 of file Tensor2_symmetric_pointer.hpp.

81  {
82 #ifdef FTENSOR_DEBUG
83  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
84  {
85  std::stringstream s;
86  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim << ">.ptr("
87  << N1 << "," << N2 << ")" << std::endl;
88  throw std::out_of_range(s.str());
89  }
90 #endif
91  return N1 > N2 ? data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
92  : data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
93  }
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]
mutableprotected

Definition at line 13 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: