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

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

Inheritance diagram for FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >:
[legend]
Collaboration diagram for FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >:
[legend]

Public Member Functions

 Tensor2 (T *d00, T *d01, T *d10, T *d11, const int i=1)
 
 Tensor2 (T *d00, T *d01, T *d10, T *d11, T *d20, T *d21, const int i=1)
 
 Tensor2 (T *d00, T *d01, T *d02, T *d10, T *d11, T *d12, T *d20, T *d21, T *d22, const int i=1)
 
 Tensor2 (T *d00, T *d01, T *d02, T *d03, T *d10, T *d11, T *d12, T *d13, T *d20, T *d21, T *d22, T *d23, T *d30, T *d31, T *d32, T *d33, const int i=1)
 
template<class... U>
 Tensor2 (U *... d)
 
 Tensor2 ()
 
 Tensor2 (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< T *, 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< T *, 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< T *, 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< T *, 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< T *, 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< T *, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > operator() (const Number< N >, const Index< i, Dim >) const
 
const Tensor2operator++ () const
 
template<char i, int Dim>
T operator() (const Index< i, Dim >, const Index< i, Dim > index2)
 
template<char i, int Dim>
T operator() (const Index< i, Dim >, const Index< i, Dim > index2) const
 

Protected Attributes

const int inc
 
T *restrict data [Tensor_Dim0][Tensor_Dim1]
 

Private Member Functions

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

Detailed Description

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

Definition at line 9 of file Tensor2_pointer.hpp.

Constructor & Destructor Documentation

◆ Tensor2() [1/7]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( T d00,
T d01,
T d10,
T d11,
const int  i = 1 
)

Definition at line 19 of file Tensor2_pointer.hpp.

19  : inc(i)
20  {
21  Tensor2_constructor<T * restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
22  data, d00, d01, d10, d11);
23  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ Tensor2() [2/7]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( T d00,
T d01,
T d10,
T d11,
T d20,
T d21,
const int  i = 1 
)

Definition at line 24 of file Tensor2_pointer.hpp.

25  : inc(i)
26  {
27  Tensor2_constructor<T * restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
28  data, d00, d01, d10, d11, d20, d21);
29  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ Tensor2() [3/7]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( T d00,
T d01,
T d02,
T d10,
T d11,
T d12,
T d20,
T d21,
T d22,
const int  i = 1 
)

Definition at line 30 of file Tensor2_pointer.hpp.

32  : inc(i)
33  {
34  Tensor2_constructor<T * restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
35  data, d00, d01, d02, d10, d11, d12, d20, d21, d22);
36  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ Tensor2() [4/7]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( T d00,
T d01,
T d02,
T d03,
T d10,
T d11,
T d12,
T d13,
T d20,
T d21,
T d22,
T d23,
T d30,
T d31,
T d32,
T d33,
const int  i = 1 
)

Definition at line 37 of file Tensor2_pointer.hpp.

40  : inc(i)
41  {
42  Tensor2_constructor<T * restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
43  data, d00, d01, d02, d03, d10, d11, d12, d13, d20, d21, d22, d23, d30,
44  d31, d32, d33);
45  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ Tensor2() [5/7]

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

Definition at line 48 of file Tensor2_pointer.hpp.

48 : data{d...}, inc(1) {}
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_Dim0][Tensor_Dim1]

◆ Tensor2() [6/7]

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

Definition at line 50 of file Tensor2_pointer.hpp.

50 {}

◆ Tensor2() [7/7]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( const int  i = 1)

Definition at line 53 of file Tensor2_pointer.hpp.

Member Function Documentation

◆ internal_contract() [1/2]

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

Definition at line 202 of file Tensor2_pointer.hpp.

203  {
204  return *data[N - 1][N - 1] + internal_contract(Number<N - 1>());
205  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]
const int N
Definition: speed_test.cpp:3

◆ internal_contract() [2/2]

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

Definition at line 207 of file Tensor2_pointer.hpp.

207 { return *data[0][0]; }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ operator()() [1/10]

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

Definition at line 58 of file Tensor2_pointer.hpp.

59  {
60 #ifdef FTENSOR_DEBUG
61  if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
62  {
63  std::stringstream s;
64  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
65  << ">.operator(" << N1 << "," << N2 << ")" << std::endl;
66  throw std::out_of_range(s.str());
67  }
68 #endif
69  return *data[N1][N2];
70  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ operator()() [2/10]

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

Definition at line 72 of file Tensor2_pointer.hpp.

73  {
74 #ifdef FTENSOR_DEBUG
75  if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
76  {
77  std::stringstream s;
78  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
79  << ">.operator(" << N1 << "," << N2 << ") const" << std::endl;
80  throw std::out_of_range(s.str());
81  }
82 #endif
83  return *data[N1][N2];
84  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ operator()() [3/10]

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

Definition at line 107 of file Tensor2_pointer.hpp.

108  {
109  return Tensor2_Expr<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, Dim0,
110  Dim1, i, j>(*this);
111  }

◆ operator()() [4/10]

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

Definition at line 116 of file Tensor2_pointer.hpp.

117  {
118  return Tensor2_Expr<const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T,
119  Dim0, Dim1, i, j>(*this);
120  }

◆ operator()() [5/10]

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

Definition at line 133 of file Tensor2_pointer.hpp.

134  {
135  using TensorExpr
136  = Tensor2_number_rhs_1<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
138  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [6/10]

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

Definition at line 144 of file Tensor2_pointer.hpp.

145  {
146  using TensorExpr
147  = Tensor2_number_rhs_0<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
149  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [7/10]

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

Definition at line 155 of file Tensor2_pointer.hpp.

156  {
157  using TensorExpr
158  = Tensor2_number_1<const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
159  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
160  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [8/10]

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

Definition at line 166 of file Tensor2_pointer.hpp.

167  {
168  using TensorExpr
169  = Tensor2_number_0<const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
170  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
171  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [9/10]

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

Definition at line 190 of file Tensor2_pointer.hpp.

191  {
192  return internal_contract(Number<Dim>());
193  }

◆ operator()() [10/10]

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

Definition at line 196 of file Tensor2_pointer.hpp.

197  {
198  return internal_contract(Number<Dim>());
199  }

◆ operator++()

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

Definition at line 176 of file Tensor2_pointer.hpp.

177  {
178  for(int i = 0; i < Tensor_Dim0; ++i)
179  for(int j = 0; j < Tensor_Dim1; ++j)
180  data[i][j] += inc;
181  return *this;
182  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ ptr()

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

Definition at line 86 of file Tensor2_pointer.hpp.

87  {
88 #ifdef FTENSOR_DEBUG
89  if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
90  {
91  std::stringstream s;
92  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
93  << ">.ptr(" << N1 << "," << N2 << ")" << std::endl;
94  throw std::out_of_range(s.str());
95  }
96 #endif
97  return data[N1][N2];
98  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

Member Data Documentation

◆ data

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

Definition at line 14 of file Tensor2_pointer.hpp.

◆ inc

template<class T , int Tensor_Dim0, int Tensor_Dim1>
const int FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::inc
protected

Definition at line 13 of file Tensor2_pointer.hpp.


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