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

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

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)
 
 Tensor2 (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< 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 Tensor2< T *, 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

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

Detailed Description

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

Definition at line 175 of file Tensor2_pointer.hpp.

Constructor & Destructor Documentation

◆ Tensor2() [1/5]

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 184 of file Tensor2_pointer.hpp.

184  : inc(i)
185  {
186  Tensor2_constructor<T * restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
187  data, d00, d01, d10, d11);
188  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ Tensor2() [2/5]

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 189 of file Tensor2_pointer.hpp.

190  : inc(i)
191  {
192  Tensor2_constructor<T * restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
193  data, d00, d01, d10, d11, d20, d21);
194  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ Tensor2() [3/5]

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 195 of file Tensor2_pointer.hpp.

197  : inc(i)
198  {
199  Tensor2_constructor<T * restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
200  data, d00, d01, d02, d10, d11, d12, d20, d21, d22);
201  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ Tensor2() [4/5]

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 202 of file Tensor2_pointer.hpp.

205  : inc(i)
206  {
207  Tensor2_constructor<T * restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
208  data, d00, d01, d02, d03, d10, d11, d12, d13, d20, d21, d22, d23, d30,
209  d31, d32, d33);
210  }
T *restrict data[Tensor_Dim0][Tensor_Dim1]

◆ Tensor2() [5/5]

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

Definition at line 211 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 360 of file Tensor2_pointer.hpp.

361  {
362  return *data[N - 1][N - 1] + internal_contract(Number<N - 1>());
363  }
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 365 of file Tensor2_pointer.hpp.

365 { 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 216 of file Tensor2_pointer.hpp.

217  {
218 #ifdef FTENSOR_DEBUG
219  if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
220  {
221  std::stringstream s;
222  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
223  << ">.operator(" << N1 << "," << N2 << ")" << std::endl;
224  throw std::out_of_range(s.str());
225  }
226 #endif
227  return *data[N1][N2];
228  }
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 230 of file Tensor2_pointer.hpp.

231  {
232 #ifdef FTENSOR_DEBUG
233  if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
234  {
235  std::stringstream s;
236  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
237  << ">.operator(" << N1 << "," << N2 << ") const" << std::endl;
238  throw std::out_of_range(s.str());
239  }
240 #endif
241  return *data[N1][N2];
242  }
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 265 of file Tensor2_pointer.hpp.

266  {
267  return Tensor2_Expr<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, Dim0,
268  Dim1, i, j>(*this);
269  }

◆ 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 274 of file Tensor2_pointer.hpp.

275  {
276  return Tensor2_Expr<const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T,
277  Dim0, Dim1, i, j>(*this);
278  }

◆ 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 291 of file Tensor2_pointer.hpp.

292  {
293  using TensorExpr
294  = Tensor2_number_rhs_1<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
296  }
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 302 of file Tensor2_pointer.hpp.

303  {
304  using TensorExpr
305  = Tensor2_number_rhs_0<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
307  }
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 313 of file Tensor2_pointer.hpp.

314  {
315  using TensorExpr
316  = Tensor2_number_1<const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
317  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
318  }
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 324 of file Tensor2_pointer.hpp.

325  {
326  using TensorExpr
327  = Tensor2_number_0<const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
328  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
329  }
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 348 of file Tensor2_pointer.hpp.

349  {
350  return internal_contract(Number<Dim>());
351  }

◆ 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 354 of file Tensor2_pointer.hpp.

355  {
356  return internal_contract(Number<Dim>());
357  }

◆ operator++()

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

Definition at line 334 of file Tensor2_pointer.hpp.

335  {
336  for(int i = 0; i < Tensor_Dim0; ++i)
337  for(int j = 0; j < Tensor_Dim1; ++j)
338  data[i][j] += inc;
339  return *this;
340  }
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 244 of file Tensor2_pointer.hpp.

245  {
246 #ifdef FTENSOR_DEBUG
247  if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
248  {
249  std::stringstream s;
250  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
251  << ">.ptr(" << N1 << "," << N2 << ")" << std::endl;
252  throw std::out_of_range(s.str());
253  }
254 #endif
255  return data[N1][N2];
256  }
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]
mutableprivate

Definition at line 178 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
private

Definition at line 177 of file Tensor2_pointer.hpp.


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