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

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

Public Member Functions

 Tensor2 (T d00, T d01)
 
 Tensor2 (T d00, T d01, T d10, T d11)
 
 Tensor2 (T d00, T d01, T d02, T d10, T d11, T d12, T d20, T d21, T d22)
 
 Tensor2 (T d00, T d01, T d10, T d11, T d20, T d21)
 
 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)
 
 Tensor2 ()
 
T & operator() (const int N1, const int N2)
 
operator() (const int N1, const int N2) const
 
template<char i, char j, int Dim0, int Dim1>
std::enable_if<(Tensor_Dim0 >=Dim0 &&Tensor_Dim1 >=Dim1), Tensor2_Expr< Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >, T, Dim0, Dim1, i, j > >::type operator() (const Index< i, Dim0 >, const Index< j, Dim1 >)
 
template<char i, char j, int Dim0, int Dim1>
std::enable_if<(Tensor_Dim0 >=Dim0 &&Tensor_Dim1 >=Dim1), Tensor2_Expr< const Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >, T, Dim0, Dim1, i, j > >::type operator() (const Index< i, Dim0 >, const Index< j, Dim1 >) const
 
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 >=Dim &&Tensor_Dim1 > N), Tensor1_Expr< Tensor2_number_rhs_1< Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >, T, N >, T, Dim, i > >::type operator() (const Index< i, Dim >, const Number< N >)
 
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 > N &&Tensor_Dim1 >=Dim), Tensor1_Expr< Tensor2_number_rhs_0< Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >, T, N >, T, Dim, i > >::type operator() (const Number< N >, const Index< i, Dim >)
 
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 >=Dim &&Tensor_Dim1 > N), Tensor1_Expr< const Tensor2_number_1< const Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >, T, N >, T, Dim, i > >::type operator() (const Index< i, Dim >, const Number< N >) const
 
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 > N &&Tensor_Dim1 >=Dim), Tensor1_Expr< const Tensor2_number_0< const Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >, T, N >, T, Dim, i > >::type operator() (const Number< N >, const Index< i, Dim >) const
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >=Dim), Tensor1_Expr< const Tensor2_numeral_1< const Tensor2< T, Tensor_Dim0, Tensor_Dim1 >, T >, T, Dim, i > >::type operator() (const Index< i, Dim >, const int N) const
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim1 >=Dim), Tensor1_Expr< const Tensor2_numeral_0< const Tensor2< T, Tensor_Dim0, Tensor_Dim1 >, T >, T, Dim, i > >::type operator() (const int N, const Index< i, Dim >) const
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >=Dim &&Tensor_Dim1 >=Dim), T >::type operator() (const Index< i, Dim >, const Index< i, Dim >)
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >=Dim &&Tensor_Dim1 >=Dim), T >::type operator() (const Index< i, Dim >, const Index< i, Dim >) const
 

Private Member Functions

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

Private Attributes

data [(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]
 

Detailed Description

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

Definition at line 18 of file Tensor2_value.hpp.

Constructor & Destructor Documentation

◆ Tensor2() [1/6]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::Tensor2 ( d00,
d01 
)

Definition at line 27 of file Tensor2_value.hpp.

28  {
29  Tensor2_constructor<T,Tensor_Dim0,Tensor_Dim1,layout>
30  (data,d00,d01);
31  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ Tensor2() [2/6]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::Tensor2 ( d00,
d01,
d10,
d11 
)

Definition at line 32 of file Tensor2_value.hpp.

33  {
34  Tensor2_constructor<T,Tensor_Dim0,Tensor_Dim1,layout>
35  (data,d00,d01,d10,d11);
36  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ Tensor2() [3/6]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::Tensor2 ( d00,
d01,
d02,
d10,
d11,
d12,
d20,
d21,
d22 
)

Definition at line 37 of file Tensor2_value.hpp.

38  {
39  Tensor2_constructor<T,Tensor_Dim0,Tensor_Dim1,layout>
40  (data,d00,d01,d02,d10,d11,d12,d20,d21,d22);
41  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ Tensor2() [4/6]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::Tensor2 ( d00,
d01,
d10,
d11,
d20,
d21 
)

Definition at line 42 of file Tensor2_value.hpp.

43  {
44  Tensor2_constructor<T,Tensor_Dim0,Tensor_Dim1,layout>
45  (data,d00,d01,d10,d11,d20,d21);
46  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ Tensor2() [5/6]

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

Definition at line 47 of file Tensor2_value.hpp.

49  {
50  Tensor2_constructor<T,Tensor_Dim0,Tensor_Dim1,layout>
51  (data,d00,d01,d02,d03,d10,d11,d12,d13,d20,d21,d22,d23,d30,d31,d32,d33);
52  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ Tensor2() [6/6]

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

Definition at line 53 of file Tensor2_value.hpp.

53 {}

Member Function Documentation

◆ internal_contract() [1/2]

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

Definition at line 215 of file Tensor2_value.hpp.

216  {
217  return data[N-1][N-1] + internal_contract(Number<N-1>());
218  }
T internal_contract(Number< N >) const
const int N
Definition: speed_test.cpp:3
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ internal_contract() [2/2]

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

Definition at line 220 of file Tensor2_value.hpp.

221  {
222  return data[0][0];
223  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ operator()() [1/12]

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

Definition at line 58 of file Tensor2_value.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,"
65  << Tensor_Dim0 << "," << Tensor_Dim1
66  << ">.operator(" << N1 << "," << N2 << ")"
67  << std::endl;
68  throw std::runtime_error(s.str());
69  }
70 #endif
71  return ((layout==column_major) ? data[N1][N2] : data[N2][N1]);
72  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ operator()() [2/12]

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

Definition at line 74 of file Tensor2_value.hpp.

75  {
76 #ifdef FTENSOR_DEBUG
77  if(N1>=Tensor_Dim0 || N1<0 || N2>=Tensor_Dim1 || N2<0)
78  {
79  std::stringstream s;
80  s << "Bad index in Tensor2<T,"
81  << Tensor_Dim0 << "," << Tensor_Dim1
82  << ">.operator(" << N1 << "," << N2 << ") const"
83  << std::endl;
84  throw std::runtime_error(s.str());
85  }
86 #endif
87  return ((layout==column_major) ? data[N1][N2] : data[N2][N1]);
88  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ operator()() [3/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, char j, int Dim0, int Dim1>
std::enable_if<(Tensor_Dim0 >= Dim0 && Tensor_Dim1 >= Dim1), Tensor2_Expr<Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>,T,Dim0,Dim1,i,j> >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >   
)

Definition at line 98 of file Tensor2_value.hpp.

99  {
100  return Tensor2_Expr<Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>,T,Dim0,Dim1,i,j>
101  (*this);
102  }

◆ operator()() [4/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, char j, int Dim0, int Dim1>
std::enable_if<(Tensor_Dim0 >= Dim0 && Tensor_Dim1 >= Dim1), Tensor2_Expr<const Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>,T,Dim0,Dim1,i,j> >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >   
) const

Definition at line 107 of file Tensor2_value.hpp.

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

◆ operator()() [5/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 >= Dim && Tensor_Dim1 > N), Tensor1_Expr<Tensor2_number_rhs_1<Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>, T,N>,T,Dim,i> >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim >  ,
const Number< N  
)

Definition at line 124 of file Tensor2_value.hpp.

125  {
126  typedef Tensor2_number_rhs_1<Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>,
127  T,N> TensorExpr;
128  return Tensor1_Expr<TensorExpr,T,Dim,i>(*this);
129  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [6/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 > N && Tensor_Dim1 >= Dim), Tensor1_Expr<Tensor2_number_rhs_0<Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>, T,N>,T,Dim,i> >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Number< N ,
const Index< i, Dim >   
)

Definition at line 135 of file Tensor2_value.hpp.

136  {
137  typedef Tensor2_number_rhs_0<Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>,T,N>
138  TensorExpr;
139  return Tensor1_Expr<TensorExpr,T,Dim,i>(*this);
140  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [7/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 >= Dim && Tensor_Dim1 > N), Tensor1_Expr<const Tensor2_number_1<const Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>, T,N>,T,Dim,i> >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim >  ,
const Number< N  
) const

Definition at line 146 of file Tensor2_value.hpp.

147  {
148  typedef const Tensor2_number_1<const Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>,T,N>
149  TensorExpr;
150  return Tensor1_Expr<TensorExpr,T,Dim,i>(TensorExpr(*this));
151  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [8/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 > N && Tensor_Dim1 >= Dim), Tensor1_Expr<const Tensor2_number_0<const Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>, T,N>,T,Dim,i> >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Number< N ,
const Index< i, Dim >   
) const

Definition at line 157 of file Tensor2_value.hpp.

158  {
159  typedef const Tensor2_number_0<const Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>,T,N>
160  TensorExpr;
161  return Tensor1_Expr<TensorExpr,T,Dim,i>(TensorExpr(*this));
162  }
const int N
Definition: speed_test.cpp:3

◆ operator()() [9/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >= Dim), Tensor1_Expr<const Tensor2_numeral_1<const Tensor2 <T,Tensor_Dim0,Tensor_Dim1>,T>,T,Dim,i> >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim >  ,
const int  N 
) const

Definition at line 176 of file Tensor2_value.hpp.

177  {
178  typedef const Tensor2_numeral_1<const Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>,T>
179  TensorExpr;
180  return Tensor1_Expr<TensorExpr,T,Dim,i>(TensorExpr(*this,N));
181  }

◆ operator()() [10/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, int Dim>
std::enable_if<(Tensor_Dim1 >= Dim), Tensor1_Expr<const Tensor2_numeral_0<const Tensor2 <T,Tensor_Dim0,Tensor_Dim1>,T>,T,Dim,i> >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const int  N,
const Index< i, Dim >   
) const

Definition at line 187 of file Tensor2_value.hpp.

188  {
189  typedef const Tensor2_numeral_0<const Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>,T>
190  TensorExpr;
191  return Tensor1_Expr<TensorExpr,T,Dim,i>(TensorExpr(*this,N));
192  }

◆ operator()() [11/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >= Dim && Tensor_Dim1 >= Dim), T>::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >   
)

Definition at line 202 of file Tensor2_value.hpp.

203  {
204  return internal_contract(Number<Dim>());
205  }
T internal_contract(Number< N >) const

◆ operator()() [12/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >= Dim && Tensor_Dim1 >= Dim), T>::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >   
) const

Definition at line 209 of file Tensor2_value.hpp.

210  {
211  return internal_contract(Number<Dim>());
212  }
T internal_contract(Number< N >) const

Member Data Documentation

◆ data

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
T FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]
private

Definition at line 21 of file Tensor2_value.hpp.


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