v0.6.10
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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, 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>
Tensor2_Expr< Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >, T, Dim0, Dim1, i, j > operator() (const Index< i, Dim0 >, const Index< j, Dim1 >)
 
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr< const Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >, T, Dim0, Dim1, i, j > operator() (const Index< i, Dim0 >, const Index< j, Dim1 >) const
 
template<char i, int Dim, int N>
Tensor1_Expr< Tensor2_number_rhs_1< Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >, 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, layout >, 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, layout >, 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, layout >, T, N >, T, Dim, i > operator() (const Number< N >, const Index< i, Dim >) const
 
template<char i, int Dim>
Tensor1_Expr< const Tensor2_numeral_1< const Tensor2< T, Tensor_Dim0, Tensor_Dim1 >, T >, T, Dim, i > operator() (const Index< i, Dim >, const int N) const
 
template<char i, int Dim>
Tensor1_Expr< const Tensor2_numeral_0< const Tensor2< T, Tensor_Dim0, Tensor_Dim1 >, T >, T, Dim, i > operator() (const int N, const Index< i, Dim >) const
 
template<char i, int Dim>
operator() (const Index< i, Dim >, const Index< i, Dim >)
 
template<char i, int Dim>
operator() (const Index< i, Dim >, const Index< i, Dim >) const
 

Private Member Functions

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

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 Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >

Definition at line 5 of file Tensor2_value.hpp.

Constructor & Destructor Documentation

◆ Tensor2() [1/5]

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

Definition at line 14 of file Tensor2_value.hpp.

15  {
17  (data,d00,d01,d10,d11);
18  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ Tensor2() [2/5]

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

Definition at line 19 of file Tensor2_value.hpp.

20  {
22  (data,d00,d01,d02,d10,d11,d12,d20,d21,d22);
23  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ Tensor2() [3/5]

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

Definition at line 24 of file Tensor2_value.hpp.

25  {
27  (data,d00,d01,d10,d11,d20,d21);
28  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ Tensor2() [4/5]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
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 29 of file Tensor2_value.hpp.

31  {
33  (data,d00,d01,d02,d03,d10,d11,d12,d13,d20,d21,d22,d23,d30,d31,d32,d33);
34  }
T data[(layout==column_major) ? Tensor_Dim0 :Tensor_Dim1][(layout==column_major) ? Tensor_Dim1 :Tensor_Dim0]

◆ Tensor2() [5/5]

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

Definition at line 35 of file Tensor2_value.hpp.

35 {}

Member Function Documentation

◆ internal_contract() [1/2]

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

Definition at line 182 of file Tensor2_value.hpp.

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

◆ internal_contract() [2/2]

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

Definition at line 187 of file Tensor2_value.hpp.

188  {
189  return data[0][0];
190  }
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& Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const int  N1,
const int  N2 
)

Definition at line 40 of file Tensor2_value.hpp.

41  {
42 #ifdef FTENSOR_DEBUG
43  if(N1>=Tensor_Dim0 || N1<0 || N2>=Tensor_Dim1 || N2<0)
44  {
45  std::stringstream s;
46  s << "Bad index in Tensor2<T,"
47  << Tensor_Dim0 << "," << Tensor_Dim1
48  << ">.operator(" << N1 << "," << N2 << ")"
49  << std::endl;
50  throw std::runtime_error(s.str());
51  }
52 #endif
53  return ((layout==column_major) ? data[N1][N2] : data[N2][N1]);
54  }
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 Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const int  N1,
const int  N2 
) const

Definition at line 56 of file Tensor2_value.hpp.

57  {
58 #ifdef FTENSOR_DEBUG
59  if(N1>=Tensor_Dim0 || N1<0 || N2>=Tensor_Dim1 || N2<0)
60  {
61  std::stringstream s;
62  s << "Bad index in Tensor2<T,"
63  << Tensor_Dim0 << "," << Tensor_Dim1
64  << ">.operator(" << N1 << "," << N2 << ") const"
65  << std::endl;
66  throw std::runtime_error(s.str());
67  }
68 #endif
69  return ((layout==column_major) ? data[N1][N2] : data[N2][N1]);
70  }
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>
Tensor2_Expr<Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>,T,Dim0,Dim1,i,j> Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >   
)

Definition at line 79 of file Tensor2_value.hpp.

80  {
82  (*this);
83  }

◆ operator()() [4/12]

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

Definition at line 87 of file Tensor2_value.hpp.

88  {
90  T,Dim0,Dim1,i,j>(*this);
91  }

◆ operator()() [5/12]

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

Definition at line 103 of file Tensor2_value.hpp.

104  {
106  T,N> TensorExpr;
107  return Tensor1_Expr<TensorExpr,T,Dim,i>(*this);
108  }
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>
Tensor1_Expr<Tensor2_number_rhs_0<Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>, T,N>,T,Dim,i> Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Number< N ,
const Index< i, Dim >   
)

Definition at line 113 of file Tensor2_value.hpp.

114  {
116  TensorExpr;
117  return Tensor1_Expr<TensorExpr,T,Dim,i>(*this);
118  }
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>
Tensor1_Expr<const Tensor2_number_1<const Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>, T,N>,T,Dim,i> Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim >  ,
const Number< N  
) const

Definition at line 123 of file Tensor2_value.hpp.

124  {
126  TensorExpr;
127  return Tensor1_Expr<TensorExpr,T,Dim,i>(TensorExpr(*this));
128  }
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>
Tensor1_Expr<const Tensor2_number_0<const Tensor2<T,Tensor_Dim0,Tensor_Dim1,layout>, T,N>,T,Dim,i> Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Number< N ,
const Index< i, Dim >   
) const

Definition at line 133 of file Tensor2_value.hpp.

134  {
136  TensorExpr;
137  return Tensor1_Expr<TensorExpr,T,Dim,i>(TensorExpr(*this));
138  }
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>
Tensor1_Expr<const Tensor2_numeral_1<const Tensor2 <T,Tensor_Dim0,Tensor_Dim1>,T>,T,Dim,i> Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim >  ,
const int  N 
) const

Definition at line 147 of file Tensor2_value.hpp.

148  {
150  TensorExpr;
151  return Tensor1_Expr<TensorExpr,T,Dim,i>(TensorExpr(*this,N));
152  }

◆ operator()() [10/12]

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

Definition at line 157 of file Tensor2_value.hpp.

158  {
160  TensorExpr;
161  return Tensor1_Expr<TensorExpr,T,Dim,i>(TensorExpr(*this,N));
162  }

◆ operator()() [11/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, int Dim>
T Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >   
)

Definition at line 170 of file Tensor2_value.hpp.

171  {
172  return internal_contract(Number<Dim>());
173  }
Definition: Number.hpp:8
T internal_contract(Number< N >)

◆ operator()() [12/12]

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
template<char i, int Dim>
T Tensor2< T, Tensor_Dim0, Tensor_Dim1, layout >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >   
) const

Definition at line 176 of file Tensor2_value.hpp.

177  {
178  return internal_contract(Number<Dim>());
179  }
Definition: Number.hpp:8
T internal_contract(Number< N >)

Member Data Documentation

◆ data

template<class T, int Tensor_Dim0, int Tensor_Dim1, Layout layout>
T 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 8 of file Tensor2_value.hpp.


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