QMCPACK
Tensor< T, D > Class Template Reference

Tensor<T,D> class for D by D tensor. More...

+ Inheritance diagram for Tensor< T, D >:
+ Collaboration diagram for Tensor< T, D >:

Classes

class  DontInitialize
 

Public Types

enum  { ElemDim = 2 }
 
enum  { Size = D * D }
 
using Type_t = T
 

Public Member Functions

 Tensor ()
 
 Tensor (DontInitialize)
 
 Tensor (const Tensor &rhs)=default
 
template<class T1 >
 Tensor (const Tensor< T1, D > &rhs)
 
 Tensor (const T &x00)
 
 Tensor (const T &x00, const T &x10, const T &x01, const T &x11)
 
 Tensor (const T &x00, const T &x10, const T &x20, const T &x01, const T &x11, const T &x21, const T &x02, const T &x12, const T &x22)
 
 Tensor (const SymTensor< T, D > &)
 
 Tensor (const AntiSymTensor< T, D > &)
 
 ~Tensor ()
 
Tensoroperator= (const Tensor &rhs)=default
 
template<class T1 >
Tensor< T, D > & operator= (const Tensor< T1, D > &rhs)
 
Tensor< T, D > & operator= (const T &rhs)
 
template<class T1 >
Tensor< T, D > & operator+= (const Tensor< T1, D > &rhs)
 
Tensor< T, D > & operator+= (const T &rhs)
 
template<class T1 >
Tensor< T, D > & operator-= (const Tensor< T1, D > &rhs)
 
Tensor< T, D > & operator-= (const T &rhs)
 
template<class T1 >
Tensor< T, D > & operator*= (const Tensor< T1, D > &rhs)
 
Tensor< T, D > & operator*= (const T &rhs)
 
template<class T1 >
Tensor< T, D > & operator/= (const Tensor< T1, D > &rhs)
 
Tensor< T, D > & operator/= (const T &rhs)
 
void diagonal (const T &rhs)
 
void add2diagonal (T rhs)
 
int len () const
 return the size More...
 
int size () const
 return the size More...
 
Type_toperator[] (unsigned int i)
 return the i-th value or assign More...
 
Type_t operator[] (unsigned int i) const
 return the i-th value More...
 
Type_toperator() (unsigned int i)
 
Type_t operator() (unsigned int i) const
 
Type_t operator() (unsigned int i, unsigned int j) const
 return the (i,j) component More...
 
Type_toperator() (unsigned int i, unsigned int j)
 return/assign the (i,j) component More...
 
TinyVector< T, D > getRow (unsigned int i)
 
TinyVector< T, D > getColumn (unsigned int i)
 
Type_tdata ()
 
const Type_tdata () const
 
Type_tbegin ()
 
const Type_tbegin () const
 
Type_tend ()
 
const Type_tend () const
 

Private Attributes

X [Size]
 

Detailed Description

template<class T, unsigned D>
class qmcplusplus::Tensor< T, D >

Tensor<T,D> class for D by D tensor.

Template Parameters
Tdatatype
Ddimension

Definition at line 32 of file OhmmsTinyMeta.h.


Class Documentation

◆ qmcplusplus::Tensor::DontInitialize

class qmcplusplus::Tensor::DontInitialize

template<class T, unsigned D>
class qmcplusplus::Tensor< T, D >::DontInitialize

Definition at line 76 of file Tensor.h.

+ Collaboration diagram for Tensor< T, D >::DontInitialize:

Member Typedef Documentation

◆ Type_t

using Type_t = T

Definition at line 58 of file Tensor.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ElemDim 

Definition at line 59 of file Tensor.h.

60  {
61  ElemDim = 2
62  };

◆ anonymous enum

anonymous enum
Enumerator
Size 

Definition at line 63 of file Tensor.h.

64  {
65  Size = D * D
66  };

Constructor & Destructor Documentation

◆ Tensor() [1/9]

Tensor ( )
inline

Definition at line 69 of file Tensor.h.

70  {
71  for (size_t d = 0; d < Size; ++d)
72  X[d] = T(0);
73  }

◆ Tensor() [2/9]

Tensor ( DontInitialize  )
inline

Definition at line 78 of file Tensor.h.

78 {}

◆ Tensor() [3/9]

Tensor ( const Tensor< T, D > &  rhs)
inlinedefault

◆ Tensor() [4/9]

Tensor ( const Tensor< T1, D > &  rhs)
inline

Definition at line 84 of file Tensor.h.

85  {
86  for (size_t d = 0; d < Size; ++d)
87  X[d] = rhs[d];
88  }

◆ Tensor() [5/9]

Tensor ( const T &  x00)
inline

Definition at line 91 of file Tensor.h.

92  {
93  for (size_t d = 0; d < Size; ++d)
94  X[d] = x00;
95  }

◆ Tensor() [6/9]

Tensor ( const T &  x00,
const T &  x10,
const T &  x01,
const T &  x11 
)
inline

Definition at line 98 of file Tensor.h.

99  {
100  X[0] = x00;
101  X[1] = x10;
102  X[2] = x01;
103  X[3] = x11;
104  }

◆ Tensor() [7/9]

Tensor ( const T &  x00,
const T &  x10,
const T &  x20,
const T &  x01,
const T &  x11,
const T &  x21,
const T &  x02,
const T &  x12,
const T &  x22 
)
inline

Definition at line 106 of file Tensor.h.

115  {
116  X[0] = x00;
117  X[1] = x10;
118  X[2] = x20;
119  X[3] = x01;
120  X[4] = x11;
121  X[5] = x21;
122  X[6] = x02;
123  X[7] = x12;
124  X[8] = x22;
125  }

◆ Tensor() [8/9]

Tensor ( const SymTensor< T, D > &  rhs)

Definition at line 549 of file Tensor.h.

550 {
551  for (int i = 0; i < D; ++i)
552  for (int j = 0; j < D; ++j)
553  (*this)(i, j) = rhs(i, j);
554 }

◆ Tensor() [9/9]

Tensor ( const AntiSymTensor< T, D > &  rhs)

Definition at line 557 of file Tensor.h.

558 {
559  for (int i = 0; i < D; ++i)
560  for (int j = 0; j < D; ++j)
561  (*this)(i, j) = rhs(i, j);
562 }

◆ ~Tensor()

~Tensor ( )
inline

Definition at line 134 of file Tensor.h.

134 {};

Member Function Documentation

◆ add2diagonal()

void add2diagonal ( rhs)
inline

Definition at line 211 of file Tensor.h.

212  {
213  for (int i = 0; i < D; i++)
214  (*this)(i, i) += rhs;
215  }

◆ begin() [1/2]

Type_t* begin ( )
inline

Definition at line 269 of file Tensor.h.

Referenced by EinsplineSetBuilder::BroadcastOrbitalInfo(), and qmcplusplus::MatrixOperators::product().

269 { return X; }

◆ begin() [2/2]

const Type_t* begin ( ) const
inline

Definition at line 270 of file Tensor.h.

270 { return X; }

◆ data() [1/2]

Type_t* data ( )
inline

Definition at line 267 of file Tensor.h.

Referenced by h5_space_type< Tensor< T, D >, RANK >::get_address().

267 { return X; }

◆ data() [2/2]

const Type_t* data ( ) const
inline

Definition at line 268 of file Tensor.h.

268 { return X; }

◆ diagonal()

void diagonal ( const T &  rhs)
inline

◆ end() [1/2]

Type_t* end ( )
inline

Definition at line 271 of file Tensor.h.

Referenced by EinsplineSetBuilder::BroadcastOrbitalInfo().

271 { return X + Size; }

◆ end() [2/2]

const Type_t* end ( ) const
inline

Definition at line 272 of file Tensor.h.

272 { return X + Size; }

◆ getColumn()

TinyVector<T, D> getColumn ( unsigned int  i)
inline

Definition at line 259 of file Tensor.h.

260  {
261  TinyVector<T, D> res;
262  for (int j = 0; j < D; j++)
263  res[j] = X[j * D + i];
264  return res;
265  }

◆ getRow()

TinyVector<T, D> getRow ( unsigned int  i)
inline

Definition at line 251 of file Tensor.h.

252  {
253  TinyVector<T, D> res;
254  for (int j = 0; j < D; j++)
255  res[j] = X[i * D + j];
256  return res;
257  }

◆ len()

int len ( void  ) const
inline

return the size

Definition at line 218 of file Tensor.h.

218 { return Size; }

◆ operator()() [1/4]

Type_t& operator() ( unsigned int  i)
inline

Definition at line 234 of file Tensor.h.

234 { return X[i]; }

◆ operator()() [2/4]

Type_t operator() ( unsigned int  i) const
inline

Definition at line 236 of file Tensor.h.

236 { return X[i]; }

◆ operator()() [3/4]

Type_t operator() ( unsigned int  i,
unsigned int  j 
) const
inline

return the (i,j) component

Parameters
iindex [0,D)
jindex [0,D)

Definition at line 243 of file Tensor.h.

243 { return X[i * D + j]; }

◆ operator()() [4/4]

Type_t& operator() ( unsigned int  i,
unsigned int  j 
)
inline

return/assign the (i,j) component

Parameters
iindex [0,D)
jindex [0,D)

Definition at line 249 of file Tensor.h.

249 { return X[i * D + j]; }

◆ operator*=() [1/2]

Tensor<T, D>& operator*= ( const Tensor< T1, D > &  rhs)
inline

Definition at line 178 of file Tensor.h.

179  {
180  OTAssign<Tensor<T, D>, Tensor<T1, D>, OpMultiplyAssign>::apply(*this, rhs, OpMultiplyAssign());
181  return *this;
182  }

◆ operator*=() [2/2]

Tensor<T, D>& operator*= ( const T &  rhs)
inline

Definition at line 184 of file Tensor.h.

185  {
186  OTAssign<Tensor<T, D>, T, OpMultiplyAssign>::apply(*this, rhs, OpMultiplyAssign());
187  return *this;
188  }

◆ operator+=() [1/2]

Tensor<T, D>& operator+= ( const Tensor< T1, D > &  rhs)
inline

Definition at line 153 of file Tensor.h.

154  {
155  OTAssign<Tensor<T, D>, Tensor<T1, D>, OpAddAssign>::apply(*this, rhs, OpAddAssign());
156  return *this;
157  }

◆ operator+=() [2/2]

Tensor<T, D>& operator+= ( const T &  rhs)
inline

Definition at line 158 of file Tensor.h.

159  {
160  OTAssign<Tensor<T, D>, T, OpAddAssign>::apply(*this, rhs, OpAddAssign());
161  return *this;
162  }

◆ operator-=() [1/2]

Tensor<T, D>& operator-= ( const Tensor< T1, D > &  rhs)
inline

Definition at line 165 of file Tensor.h.

166  {
167  OTAssign<Tensor<T, D>, Tensor<T1, D>, OpSubtractAssign>::apply(*this, rhs, OpSubtractAssign());
168  return *this;
169  }

◆ operator-=() [2/2]

Tensor<T, D>& operator-= ( const T &  rhs)
inline

Definition at line 171 of file Tensor.h.

172  {
173  OTAssign<Tensor<T, D>, T, OpSubtractAssign>::apply(*this, rhs, OpSubtractAssign());
174  return *this;
175  }

◆ operator/=() [1/2]

Tensor<T, D>& operator/= ( const Tensor< T1, D > &  rhs)
inline

Definition at line 191 of file Tensor.h.

192  {
193  OTAssign<Tensor<T, D>, Tensor<T1, D>, OpDivideAssign>::apply(*this, rhs, OpDivideAssign());
194  return *this;
195  }

◆ operator/=() [2/2]

Tensor<T, D>& operator/= ( const T &  rhs)
inline

Definition at line 197 of file Tensor.h.

198  {
199  OTAssign<Tensor<T, D>, T, OpDivideAssign>::apply(*this, rhs, OpDivideAssign());
200  return *this;
201  }

◆ operator=() [1/3]

Tensor& operator= ( const Tensor< T, D > &  rhs)
inlinedefault

◆ operator=() [2/3]

Tensor<T, D>& operator= ( const Tensor< T1, D > &  rhs)
inline

Definition at line 140 of file Tensor.h.

141  {
142  OTAssign<Tensor<T, D>, Tensor<T1, D>, OpAssign>::apply(*this, rhs, OpAssign());
143  return *this;
144  }

◆ operator=() [3/3]

Tensor<T, D>& operator= ( const T &  rhs)
inline

Definition at line 145 of file Tensor.h.

146  {
147  OTAssign<Tensor<T, D>, T, OpAssign>::apply(*this, rhs, OpAssign());
148  return *this;
149  }

◆ operator[]() [1/2]

Type_t& operator[] ( unsigned int  i)
inline

return the i-th value or assign

Parameters
iindex [0,D*D)

Definition at line 225 of file Tensor.h.

225 { return X[i]; }

◆ operator[]() [2/2]

Type_t operator[] ( unsigned int  i) const
inline

return the i-th value

Parameters
iindex [0,D*D)

Definition at line 230 of file Tensor.h.

230 { return X[i]; }

◆ size()

int size ( void  ) const
inline

return the size

Definition at line 220 of file Tensor.h.

Referenced by CountingGaussian::makeClone().

220 { return Size; }

Member Data Documentation

◆ X


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