v0.8.7
Public Member Functions | Private Member Functions | Private Attributes | List of all members
FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 > Class Template Reference

#include <src/ftensor/src/FTensor/Tensor2/Tensor2_pointer.hpp>

Public Member Functions

template<class... U>
 Tensor2 (U *... d)
 
 Tensor2 ()
 
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< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >, T, Dim0, Dim1, i, j > operator() (const Index< i, Dim0 >, const Index< j, Dim1 > index2)
 
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr< const Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >, T, Dim0, Dim1, i, j > operator() (const Index< i, Dim0 >, const Index< j, Dim1 > index2) const
 
template<char i, int Dim, int N>
Tensor1_Expr< Tensor2_number_rhs_1< Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > operator() (const Index< i, Dim >, const Number< N >)
 
template<char i, int Dim, int N>
Tensor1_Expr< Tensor2_number_rhs_0< Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > operator() (const Number< N >, const Index< i, Dim >)
 
template<char i, int Dim, int N>
Tensor1_Expr< const Tensor2_number_1< const Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > operator() (const Index< i, Dim >, const Number< N >) const
 
template<char i, int Dim, int N>
Tensor1_Expr< const Tensor2_number_0< const Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > operator() (const Number< N >, const Index< i, Dim >) const
 
const Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 > & operator++ () const
 
template<char i, int Dim>
operator() (const Index< i, Dim >, const Index< i, Dim > index2)
 
template<char i, int Dim>
operator() (const Index< i, Dim >, 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_Dim0][Tensor_Dim1]
 

Detailed Description

template<class T, int Tensor_Dim0, int Tensor_Dim1, int I>
class FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >

Definition at line 8 of file Tensor2_pointer.hpp.

Constructor & Destructor Documentation

◆ Tensor2() [1/2]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
template<class... U>
FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( U *...  d)

Definition at line 14 of file Tensor2_pointer.hpp.

14 : data{d...} {}
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() [2/2]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( )

Definition at line 17 of file Tensor2_pointer.hpp.

17 {}

Member Function Documentation

◆ internal_contract() [1/2]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
template<int N>
T FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::internal_contract ( Number< N ) const
private

Definition at line 166 of file Tensor2_pointer.hpp.

167  {
168  return *data[N - 1][N - 1] + internal_contract(Number<N - 1>());
169  }
const int N
Definition: speed_test.cpp:3

◆ internal_contract() [2/2]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
T FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::internal_contract ( Number< 1 >  ) const
private

Definition at line 171 of file Tensor2_pointer.hpp.

171 { return *data[0][0]; }

◆ operator()() [1/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
T& FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::operator() ( const int  N1,
const int  N2 
)

Definition at line 22 of file Tensor2_pointer.hpp.

23  {
24 #ifdef FTENSOR_DEBUG
25  if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
26  {
27  std::stringstream s;
28  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
29  << ">.operator(" << N1 << "," << N2 << ")" << std::endl;
30  throw std::out_of_range(s.str());
31  }
32 #endif
33  return *data[N1][N2];
34  }

◆ operator()() [2/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
T FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::operator() ( const int  N1,
const int  N2 
) const

Definition at line 36 of file Tensor2_pointer.hpp.

37  {
38 #ifdef FTENSOR_DEBUG
39  if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
40  {
41  std::stringstream s;
42  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
43  << ">.operator(" << N1 << "," << N2 << ") const" << std::endl;
44  throw std::out_of_range(s.str());
45  }
46 #endif
47  return *data[N1][N2];
48  }

◆ operator()() [3/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr<Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T, Dim0, Dim1, i, j> FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >  index2 
)

Definition at line 71 of file Tensor2_pointer.hpp.

72  {
73  return Tensor2_Expr<Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T, Dim0,
74  Dim1, i, j>(*this);
75  }

◆ operator()() [4/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr<const Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T, Dim0, Dim1, i, j> FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >  index2 
) const

Definition at line 80 of file Tensor2_pointer.hpp.

81  {
82  return Tensor2_Expr<const Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T,
83  Dim0, Dim1, i, j>(*this);
84  }

◆ operator()() [5/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
template<char i, int Dim, int N>
Tensor1_Expr< Tensor2_number_rhs_1<Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T, N>, T, Dim, i> FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const Number< N  
)

Definition at line 97 of file Tensor2_pointer.hpp.

98  {
99  using TensorExpr
100  = Tensor2_number_rhs_1<Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T, N>;
102  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [6/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
template<char i, int Dim, int N>
Tensor1_Expr< Tensor2_number_rhs_0<Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T, N>, T, Dim, i> FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Number< N ,
const Index< i, Dim >   
)

Definition at line 108 of file Tensor2_pointer.hpp.

109  {
110  using TensorExpr
111  = Tensor2_number_rhs_0<Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T, N>;
113  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [7/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
template<char i, int Dim, int N>
Tensor1_Expr<const Tensor2_number_1< const Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T, N>, T, Dim, i> FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const Number< N  
) const

Definition at line 119 of file Tensor2_pointer.hpp.

120  {
121  using TensorExpr
122  = Tensor2_number_1<const Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T, N>;
123  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
124  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [8/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
template<char i, int Dim, int N>
Tensor1_Expr<const Tensor2_number_0< const Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T, N>, T, Dim, i> FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Number< N ,
const Index< i, Dim >   
) const

Definition at line 130 of file Tensor2_pointer.hpp.

131  {
132  using TensorExpr
133  = Tensor2_number_0<const Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>, T, N>;
134  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
135  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [9/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
template<char i, int Dim>
T FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >  index2 
)

Definition at line 154 of file Tensor2_pointer.hpp.

155  {
156  return internal_contract(Number<Dim>());
157  }

◆ operator()() [10/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
template<char i, int Dim>
T FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >  index2 
) const

Definition at line 160 of file Tensor2_pointer.hpp.

161  {
162  return internal_contract(Number<Dim>());
163  }

◆ operator++()

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
const Tensor2<PackPtr<T *, I>, Tensor_Dim0, Tensor_Dim1>& FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::operator++ ( ) const

Definition at line 140 of file Tensor2_pointer.hpp.

141  {
142  for(int i = 0; i < Tensor_Dim0; ++i)
143  for(int j = 0; j < Tensor_Dim1; ++j)
144  data[i][j] += I;
145  return *this;
146  }

◆ ptr()

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
T* FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::ptr ( const int  N1,
const int  N2 
) const

Definition at line 50 of file Tensor2_pointer.hpp.

51  {
52 #ifdef FTENSOR_DEBUG
53  if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
54  {
55  std::stringstream s;
56  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
57  << ">.ptr(" << N1 << "," << N2 << ")" << std::endl;
58  throw std::out_of_range(s.str());
59  }
60 #endif
61  return data[N1][N2];
62  }

Member Data Documentation

◆ data

template<class T , int Tensor_Dim0, int Tensor_Dim1, int I>
T* restrict FTensor::Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 >::data[Tensor_Dim0][Tensor_Dim1]
mutableprivate

Definition at line 10 of file Tensor2_pointer.hpp.


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