QMCPACK
SymTensor< T, D > Class Template Reference
+ Inheritance diagram for SymTensor< T, D >:
+ Collaboration diagram for SymTensor< T, D >:

Classes

class  DontInitialize
 

Public Types

enum  { ElemDim = 2 }
 
enum  { Size = D * (D + 1) / 2 }
 
using Type_t = T
 

Public Member Functions

 SymTensor ()
 
 SymTensor (DontInitialize)
 
 SymTensor (const T &x00)
 
 SymTensor (const T &x00, const T &x10, const T &x11)
 
 SymTensor (const T &x00, const T &x10, const T &x11, const T &x20, const T &x21, const T &x22)
 
template<typename T1 >
 SymTensor (const SymTensor< T1, D > &rhs)
 
 SymTensor (const Tensor< T, D > &t)
 
 ~SymTensor ()
 
SymTensor< T, D > & operator= (const SymTensor< T, D > &rhs)
 
template<class T1 >
SymTensor< T, D > & operator= (const SymTensor< T1, D > &rhs)
 
SymTensor< T, D > & operator= (const T &rhs)
 
SymTensor< T, D > & operator= (const Tensor< T, D > &rhs)
 
template<class T1 >
SymTensor< T, D > & operator+= (const SymTensor< T1, D > &rhs)
 
SymTensor< T, D > & operator+= (const T &rhs)
 
template<class T1 >
SymTensor< T, D > & operator-= (const SymTensor< T1, D > &rhs)
 
SymTensor< T, D > & operator-= (const T &rhs)
 
template<class T1 >
SymTensor< T, D > & operator*= (const SymTensor< T1, D > &rhs)
 
SymTensor< T, D > & operator*= (const T &rhs)
 
template<class T1 >
SymTensor< T, D > & operator/= (const SymTensor< T1, D > &rhs)
 
SymTensor< T, D > & operator/= (const T &rhs)
 
void diagonal (const T &rhs)
 
int len (void) const
 
int size (void) const
 
int get_Size (void) const
 
Type_t operator() (unsigned int i, unsigned int j) const
 
Type_toperator() (unsigned int i, unsigned int j)
 
Type_t HL (unsigned int hi, unsigned int lo) const
 
Type_tHL (unsigned int hi, unsigned int lo)
 
Type_toperator[] (unsigned int i)
 
Type_t operator[] (unsigned int i) const
 
Type_toperator() (unsigned int i)
 
Type_t operator() (unsigned int i) const
 

Private Attributes

X [Size]
 

Detailed Description

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

Definition at line 34 of file OhmmsTinyMeta.h.


Class Documentation

◆ qmcplusplus::SymTensor::DontInitialize

class qmcplusplus::SymTensor::DontInitialize

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

Definition at line 74 of file SymTensor.h.

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

Member Typedef Documentation

◆ Type_t

using Type_t = T

Definition at line 60 of file SymTensor.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ElemDim 

Definition at line 61 of file SymTensor.h.

62  {
63  ElemDim = 2
64  };

◆ anonymous enum

anonymous enum
Enumerator
Size 

Definition at line 65 of file SymTensor.h.

66  {
67  Size = D * (D + 1) / 2
68  };

Constructor & Destructor Documentation

◆ SymTensor() [1/7]

SymTensor ( )
inline

Definition at line 71 of file SymTensor.h.

71 { OTAssign<SymTensor<T, D>, T, OpAssign>::apply(*this, T(0), OpAssign()); }

◆ SymTensor() [2/7]

SymTensor ( DontInitialize  )
inline

Definition at line 76 of file SymTensor.h.

76 {}

◆ SymTensor() [3/7]

SymTensor ( const T &  x00)
inline

Definition at line 79 of file SymTensor.h.

79 { OTAssign<SymTensor<T, D>, T, OpAssign>::apply(*this, x00, OpAssign()); }

◆ SymTensor() [4/7]

SymTensor ( const T &  x00,
const T &  x10,
const T &  x11 
)
inline

Definition at line 82 of file SymTensor.h.

83  {
84  X[0] = x00;
85  X[1] = x10;
86  X[2] = x11;
87  }

◆ SymTensor() [5/7]

SymTensor ( const T &  x00,
const T &  x10,
const T &  x11,
const T &  x20,
const T &  x21,
const T &  x22 
)
inline

Definition at line 89 of file SymTensor.h.

90  {
91  X[0] = x00;
92  X[1] = x10;
93  X[2] = x11;
94  X[3] = x20;
95  X[4] = x21;
96  X[5] = x22;
97  }

◆ SymTensor() [6/7]

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

Definition at line 101 of file SymTensor.h.

102  {
103  OTAssign<SymTensor<T, D>, SymTensor<T1, D>, OpAssign>::apply(*this, rhs, OpAssign());
104  }

◆ SymTensor() [7/7]

SymTensor ( const Tensor< T, D > &  t)
inline

Definition at line 108 of file SymTensor.h.

109  {
110  for (int i = 0; i < D; ++i)
111  {
112  (*this)(i, i) = t(i, i);
113  for (int j = i + 1; j < D; ++j)
114  (*this)(i, j) = (t(i, j) + t(j, i)) * 0.5;
115  }
116  }

◆ ~SymTensor()

~SymTensor ( )
inline

Definition at line 119 of file SymTensor.h.

119 {};

Member Function Documentation

◆ diagonal()

void diagonal ( const T &  rhs)
inline

Definition at line 199 of file SymTensor.h.

200  {
201  for (int i = 0; i < D; i++)
202  {
203  X[((i + 1) * i / 2) + i] = rhs;
204  }
205  }

◆ get_Size()

int get_Size ( void  ) const
inline

Definition at line 209 of file SymTensor.h.

209 { return Size; }

◆ HL() [1/2]

Type_t HL ( unsigned int  hi,
unsigned int  lo 
) const
inline

Definition at line 243 of file SymTensor.h.

Referenced by OTDot< SymTensor< T1, D >, TinyVector< T2, D > >::apply(), OTDot< SymTensor< T1, D >, Tensor< T2, D > >::apply(), OTDot< Tensor< T1, D >, SymTensor< T2, D > >::apply(), and OTDot< SymTensor< T1, D >, SymTensor< T2, D > >::apply().

244  {
245  PAssert(hi >= lo);
246  PAssert(hi < D);
247  PAssert(lo < D);
248  return X[hi * (hi + 1) / 2 + lo];
249  }
#define PAssert(condition)
Definition: OhmmsTinyMeta.h:61

◆ HL() [2/2]

Type_t& HL ( unsigned int  hi,
unsigned int  lo 
)
inline

Definition at line 250 of file SymTensor.h.

251  {
252  PAssert(hi >= lo);
253  PAssert(hi < D);
254  PAssert(lo < D);
255  return X[hi * (hi + 1) / 2 + lo];
256  }
#define PAssert(condition)
Definition: OhmmsTinyMeta.h:61

◆ len()

int len ( void  ) const
inline

Definition at line 207 of file SymTensor.h.

207 { return Size; }

◆ operator()() [1/4]

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

Definition at line 213 of file SymTensor.h.

214  {
215  int lo = i < j ? i : j;
216  int hi = i > j ? i : j;
217  return X[((hi + 1) * hi / 2) + lo];
218  }

◆ operator()() [2/4]

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

Definition at line 220 of file SymTensor.h.

221  {
222  int lo = i < j ? i : j;
223  int hi = i > j ? i : j;
224  return X[((hi + 1) * hi / 2) + lo];
225  }

◆ operator()() [3/4]

Type_t& operator() ( unsigned int  i)
inline

Definition at line 273 of file SymTensor.h.

274  {
275  PAssert(i < Size);
276  return X[i];
277  }
#define PAssert(condition)
Definition: OhmmsTinyMeta.h:61

◆ operator()() [4/4]

Type_t operator() ( unsigned int  i) const
inline

Definition at line 279 of file SymTensor.h.

280  {
281  PAssert(i < Size);
282  return X[i];
283  }
#define PAssert(condition)
Definition: OhmmsTinyMeta.h:61

◆ operator*=() [1/2]

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

Definition at line 175 of file SymTensor.h.

176  {
177  OTAssign<SymTensor<T, D>, SymTensor<T1, D>, OpMultiplyAssign>::apply(*this, rhs, OpMultiplyAssign());
178  return *this;
179  }

◆ operator*=() [2/2]

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

Definition at line 180 of file SymTensor.h.

181  {
182  OTAssign<SymTensor<T, D>, T, OpMultiplyAssign>::apply(*this, rhs, OpMultiplyAssign());
183  return *this;
184  }

◆ operator+=() [1/2]

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

Definition at line 151 of file SymTensor.h.

152  {
153  OTAssign<SymTensor<T, D>, SymTensor<T1, D>, OpAddAssign>::apply(*this, rhs, OpAddAssign());
154  return *this;
155  }

◆ operator+=() [2/2]

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

Definition at line 156 of file SymTensor.h.

157  {
158  OTAssign<SymTensor<T, D>, T, OpAddAssign>::apply(*this, rhs, OpAddAssign());
159  return *this;
160  }

◆ operator-=() [1/2]

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

Definition at line 163 of file SymTensor.h.

164  {
165  OTAssign<SymTensor<T, D>, SymTensor<T1, D>, OpSubtractAssign>::apply(*this, rhs, OpSubtractAssign());
166  return *this;
167  }

◆ operator-=() [2/2]

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

Definition at line 168 of file SymTensor.h.

169  {
170  OTAssign<SymTensor<T, D>, T, OpSubtractAssign>::apply(*this, rhs, OpSubtractAssign());
171  return *this;
172  }

◆ operator/=() [1/2]

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

Definition at line 187 of file SymTensor.h.

188  {
189  OTAssign<SymTensor<T, D>, SymTensor<T1, D>, OpDivideAssign>::apply(*this, rhs, OpDivideAssign());
190  return *this;
191  }

◆ operator/=() [2/2]

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

Definition at line 192 of file SymTensor.h.

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

◆ operator=() [1/4]

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

Definition at line 122 of file SymTensor.h.

123  {
124  OTAssign<SymTensor<T, D>, SymTensor<T, D>, OpAssign>::apply(*this, rhs, OpAssign());
125  return *this;
126  }

◆ operator=() [2/4]

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

Definition at line 128 of file SymTensor.h.

129  {
130  OTAssign<SymTensor<T, D>, SymTensor<T1, D>, OpAssign>::apply(*this, rhs, OpAssign());
131  return *this;
132  }

◆ operator=() [3/4]

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

Definition at line 133 of file SymTensor.h.

134  {
135  OTAssign<SymTensor<T, D>, T, OpAssign>::apply(*this, rhs, OpAssign());
136  return *this;
137  }

◆ operator=() [4/4]

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

Definition at line 138 of file SymTensor.h.

139  {
140  for (int i = 0; i < D; ++i)
141  {
142  (*this)(i, i) = rhs(i, i);
143  for (int j = i + 1; j < D; ++j)
144  (*this)(i, j) = (rhs(i, j) + rhs(j, i)) * 0.5;
145  }
146  return *this;
147  }

◆ operator[]() [1/2]

Type_t& operator[] ( unsigned int  i)
inline

Definition at line 258 of file SymTensor.h.

259  {
260  PAssert(i < Size);
261  return X[i];
262  }
#define PAssert(condition)
Definition: OhmmsTinyMeta.h:61

◆ operator[]() [2/2]

Type_t operator[] ( unsigned int  i) const
inline

Definition at line 264 of file SymTensor.h.

265  {
266  PAssert(i < Size);
267  return X[i];
268  }
#define PAssert(condition)
Definition: OhmmsTinyMeta.h:61

◆ size()

int size ( void  ) const
inline

Definition at line 208 of file SymTensor.h.

208 { return sizeof(*this); }

Member Data Documentation

◆ X


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