v0.8.4
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
FTensor::Tensor2_symmetric< PackPtr< T *, I >, Tensor_Dim > Class Template Reference

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

Public Types

using TPtr = PackPtr< T *, I >
 

Public Member Functions

template<class... U>
 Tensor2_symmetric (U *... d)
 
 Tensor2_symmetric ()
 
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< TPtr, 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< TPtr, 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< TPtr, 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< TPtr, 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< TPtr, 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< TPtr, 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< TPtr, 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< TPtr, 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< TPtr, 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< TPtr, Tensor_Dim >, T >, T, Dim, i > operator() (const int N, const Index< i, Dim > index1) const
 
const Tensor2_symmetric< TPtr, 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

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

Detailed Description

template<class T, int Tensor_Dim, int I>
class FTensor::Tensor2_symmetric< PackPtr< T *, I >, Tensor_Dim >

Definition at line 240 of file Tensor2_symmetric_pointer.hpp.

Member Typedef Documentation

◆ TPtr

template<class T , int Tensor_Dim, int I>
using FTensor::Tensor2_symmetric< PackPtr< T *, I >, Tensor_Dim >::TPtr = PackPtr<T *, I>

Definition at line 310 of file Tensor2_symmetric_pointer.hpp.

Constructor & Destructor Documentation

◆ Tensor2_symmetric() [1/2]

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

Definition at line 245 of file Tensor2_symmetric_pointer.hpp.

245  : data{d...}
246  {
247  static_assert(sizeof...(d) == sizeof(data) / sizeof(T),
248  "Incorrect number of Arguments. Constructor should "
249  "initialize the entire Tensor");
250  }
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

◆ Tensor2_symmetric() [2/2]

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

Definition at line 252 of file Tensor2_symmetric_pointer.hpp.

252 {}

Member Function Documentation

◆ internal_contract() [1/2]

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

Definition at line 449 of file Tensor2_symmetric_pointer.hpp.

450  {
451  return *data[N - 1 + ((N - 1) * (2 * Tensor_Dim - N)) / 2]
452  + internal_contract(Number<N - 1>());
453  }
const int N
Definition: speed_test.cpp:3

◆ internal_contract() [2/2]

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

Definition at line 455 of file Tensor2_symmetric_pointer.hpp.

455 { return *data[0]; }

◆ operator()() [1/14]

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

Definition at line 257 of file Tensor2_symmetric_pointer.hpp.

258  {
259 #ifdef FTENSOR_DEBUG
260  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
261  {
262  std::stringstream s;
263  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim
264  << ">.operator(" << N1 << "," << N2 << ")" << std::endl;
265  throw std::out_of_range(s.str());
266  }
267 #endif
268  return N1 > N2 ? *data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
269  : *data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
270  }

◆ operator()() [2/14]

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

Definition at line 272 of file Tensor2_symmetric_pointer.hpp.

273  {
274 #ifdef FTENSOR_DEBUG
275  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
276  {
277  std::stringstream s;
278  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim
279  << ">.operator(" << N1 << "," << N2 << ") const" << std::endl;
280  throw std::out_of_range(s.str());
281  }
282 #endif
283  return N1 > N2 ? *data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
284  : *data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
285  }

◆ operator()() [3/14]

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

Definition at line 314 of file Tensor2_symmetric_pointer.hpp.

315  {
316  return Tensor2_Expr<Tensor2_symmetric<TPtr, Tensor_Dim>, T, Dim0, Dim1, i,
317  j>(*this);
318  }

◆ operator()() [4/14]

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

Definition at line 322 of file Tensor2_symmetric_pointer.hpp.

323  {
324  return Tensor2_Expr<const Tensor2_symmetric<TPtr, Tensor_Dim>, T, Dim0,
325  Dim1, i, j>(*this);
326  }

◆ operator()() [5/14]

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

Definition at line 333 of file Tensor2_symmetric_pointer.hpp.

334  {
335  return Tensor2_symmetric_Expr<Tensor2_symmetric<TPtr, Tensor_Dim>, T, Dim,
336  i, j>(*this);
337  }

◆ operator()() [6/14]

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

Definition at line 342 of file Tensor2_symmetric_pointer.hpp.

343  {
344  return Tensor2_symmetric_Expr<const Tensor2_symmetric<TPtr, Tensor_Dim>,
345  T, Dim, i, j>(*this);
346  }

◆ operator()() [7/14]

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

Definition at line 358 of file Tensor2_symmetric_pointer.hpp.

359  {
360  using TensorExpr
361  = Tensor2_number_rhs_1<Tensor2_symmetric<TPtr, Tensor_Dim>, T, N>;
363  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [8/14]

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

Definition at line 369 of file Tensor2_symmetric_pointer.hpp.

370  {
371  using TensorExpr
372  = Tensor2_number_1<const Tensor2_symmetric<TPtr, Tensor_Dim>, T, N>;
373  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
374  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [9/14]

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

Definition at line 379 of file Tensor2_symmetric_pointer.hpp.

380  {
381  using TensorExpr
382  = Tensor2_number_rhs_0<Tensor2_symmetric<TPtr, Tensor_Dim>, T, N>;
384  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [10/14]

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

Definition at line 390 of file Tensor2_symmetric_pointer.hpp.

391  {
392  using TensorExpr
393  = Tensor2_number_0<const Tensor2_symmetric<TPtr, Tensor_Dim>, T, N>;
394  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
395  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [11/14]

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

Definition at line 403 of file Tensor2_symmetric_pointer.hpp.

404  {
405  using TensorExpr
406  = Tensor2_numeral_1<const Tensor2_symmetric<TPtr, Tensor_Dim>, T>;
407  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
408  }

◆ operator()() [12/14]

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

Definition at line 414 of file Tensor2_symmetric_pointer.hpp.

415  {
416  using TensorExpr
417  = Tensor2_numeral_0<const Tensor2_symmetric<TPtr, Tensor_Dim>, T>;
418  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
419  }

◆ operator()() [13/14]

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

Definition at line 437 of file Tensor2_symmetric_pointer.hpp.

438  {
439  return internal_contract(Number<Dim>());
440  }

◆ operator()() [14/14]

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

Definition at line 443 of file Tensor2_symmetric_pointer.hpp.

444  {
445  return internal_contract(Number<Dim>());
446  }

◆ operator++()

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

Definition at line 424 of file Tensor2_symmetric_pointer.hpp.

425  {
426  for(int i = 0; i < (Tensor_Dim * (Tensor_Dim + 1)) / 2; ++i)
427  data[i] += I;
428  return *this;
429  }

◆ ptr()

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

Definition at line 287 of file Tensor2_symmetric_pointer.hpp.

288  {
289 #ifdef FTENSOR_DEBUG
290  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
291  {
292  std::stringstream s;
293  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim << ">.ptr("
294  << N1 << "," << N2 << ")" << std::endl;
295  throw std::out_of_range(s.str());
296  }
297 #endif
298  return N1 > N2 ? data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
299  : data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
300  }

Member Data Documentation

◆ data

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

Definition at line 242 of file Tensor2_symmetric_pointer.hpp.


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