QMCPACK
TinyVector< T, D > Struct Template Reference

Fixed-size array. More...

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

Public Types

enum  { Size = D }
 
using Type_t = T
 

Public Member Functions

 TinyVector ()
 
 TinyVector (const TinyVector &rhs)=default
 
 TinyVector (TinyVector &&rhs)=default
 
template<class T1 >
 TinyVector (const TinyVector< T1, D > &rhs)
 
 TinyVector (const T &x00)
 
 TinyVector (const T &x00, const T &x01)
 
 TinyVector (const T &x00, const T &x01, const T &x02)
 
 TinyVector (const T &x00, const T &x01, const T &x02, const T &x03)
 
 TinyVector (const T *restrict base, int offset)
 
int size () const
 
TinyVectoroperator= (const TinyVector &rhs)=default
 
TinyVectoroperator= (TinyVector &&rhs)=default
 
template<class T1 >
TinyVector< T, D > & operator= (const TinyVector< T1, D > &rhs)
 
TinyVector< T, D > & operator= (const T &rhs)
 
Type_toperator[] (unsigned int i)
 
const Type_toperator[] (unsigned int i) const
 
Type_tdata ()
 
const Type_tdata () const
 
Type_tbegin ()
 
const Type_tbegin () const
 
Type_tend ()
 
const Type_tend () const
 
TinyVector operator- () const
 
bool operator== (const TinyVector< T, D > &that) const
 
bool operator!= (const TinyVector< T, D > &that) const
 

Public Attributes

X [Size]
 

Detailed Description

template<class T, unsigned D>
struct qmcplusplus::TinyVector< T, D >

Fixed-size array.

candidate for array<T,D>

Definition at line 30 of file OhmmsTinyMeta.h.

Member Typedef Documentation

◆ Type_t

using Type_t = T

Definition at line 53 of file TinyVector.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Size 

Definition at line 54 of file TinyVector.h.

55  {
56  Size = D
57  };

Constructor & Destructor Documentation

◆ TinyVector() [1/9]

TinyVector ( )
inline

Definition at line 61 of file TinyVector.h.

62  {
63  for (size_t d = 0; d < D; ++d)
64  X[d] = T(0);
65  }

◆ TinyVector() [2/9]

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

◆ TinyVector() [3/9]

TinyVector ( TinyVector< T, D > &&  rhs)
inlinedefault

◆ TinyVector() [4/9]

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

Definition at line 75 of file TinyVector.h.

76  {
77  for (size_t d = 0; d < D; ++d)
78  X[d] = rhs[d];
79  }

◆ TinyVector() [5/9]

TinyVector ( const T &  x00)
inline

Definition at line 82 of file TinyVector.h.

83  {
84  for (size_t d = 0; d < D; ++d)
85  X[d] = x00;
86  }

◆ TinyVector() [6/9]

TinyVector ( const T &  x00,
const T &  x01 
)
inline

Definition at line 89 of file TinyVector.h.

90  {
91  X[0] = x00;
92  X[1] = x01;
93  }

◆ TinyVector() [7/9]

TinyVector ( const T &  x00,
const T &  x01,
const T &  x02 
)
inline

Definition at line 94 of file TinyVector.h.

95  {
96  X[0] = x00;
97  X[1] = x01;
98  X[2] = x02;
99  }

◆ TinyVector() [8/9]

TinyVector ( const T &  x00,
const T &  x01,
const T &  x02,
const T &  x03 
)
inline

Definition at line 100 of file TinyVector.h.

101  {
102  X[0] = x00;
103  X[1] = x01;
104  X[2] = x02;
105  X[3] = x03;
106  }

◆ TinyVector() [9/9]

TinyVector ( const T *restrict  base,
int  offset 
)
inline

Definition at line 108 of file TinyVector.h.

109  {
110 #pragma unroll
111  for (int i = 0; i < D; ++i)
112  X[i] = base[i * offset];
113  }

Member Function Documentation

◆ begin() [1/2]

◆ begin() [2/2]

const Type_t* begin ( ) const
inline

Definition at line 141 of file TinyVector.h.

141 { return X; }

◆ data() [1/2]

◆ data() [2/2]

const Type_t* data ( ) const
inline

Definition at line 139 of file TinyVector.h.

139 { return X; }

◆ end() [1/2]

Type_t* end ( )
inline

◆ end() [2/2]

const Type_t* end ( ) const
inline

Definition at line 143 of file TinyVector.h.

143 { return X + D; }

◆ operator!=()

bool operator!= ( const TinyVector< T, D > &  that) const
inline

Definition at line 164 of file TinyVector.h.

165  {
166  for (int i = 0; i < D; ++i)
167  {
168  if ((*this)[i] == that[i])
169  return false;
170  }
171  return true;
172  }

◆ operator-()

TinyVector operator- ( ) const
inline

Definition at line 145 of file TinyVector.h.

146  {
148  for (size_t d = 0; d < D; ++d)
149  inverse[d] = -X[d];
150  return inverse;
151  }
Tensor< T, D > inverse(const Tensor< T, D > &a)
Definition: TensorOps.h:879

◆ operator=() [1/4]

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

◆ operator=() [2/4]

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

◆ operator=() [3/4]

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

Definition at line 121 of file TinyVector.h.

122  {
123  for (size_t d = 0; d < D; ++d)
124  X[d] = rhs[d];
125  return *this;
126  }

◆ operator=() [4/4]

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

Definition at line 128 of file TinyVector.h.

129  {
130  for (size_t d = 0; d < D; ++d)
131  X[d] = rhs;
132  return *this;
133  }

◆ operator==()

bool operator== ( const TinyVector< T, D > &  that) const
inline

Definition at line 154 of file TinyVector.h.

155  {
156  for (int i = 0; i < D; ++i)
157  {
158  if ((*this)[i] != that[i])
159  return false;
160  }
161  return true;
162  }

◆ operator[]() [1/2]

Type_t& operator[] ( unsigned int  i)
inline

Definition at line 136 of file TinyVector.h.

136 { return X[i]; }

◆ operator[]() [2/2]

const Type_t& operator[] ( unsigned int  i) const
inline

Definition at line 137 of file TinyVector.h.

137 { return X[i]; }

◆ size()

Member Data Documentation

◆ X


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