22 #ifndef QMCPLUSPLUS_POOLEDDATA_H 23 #define QMCPLUSPLUS_POOLEDDATA_H 33 using size_type =
typename std::vector<T>::size_type;
59 inline typename std::vector<T>::iterator
begin() {
return myData.begin(); }
61 inline typename std::vector<T>::iterator
end() {
return myData.end(); }
94 inline void add(std::complex<T>& x)
97 myData.push_back(x.real());
98 myData.push_back(x.imag());
105 myData.push_back(static_cast<T>(x));
108 template<
class _InputIterator>
109 inline void add(_InputIterator first, _InputIterator last)
115 template<
typename T1>
116 inline void add(T1* first, T1* last)
122 template<
typename T1>
123 inline void add(std::complex<T1>* first, std::complex<T1>* last)
126 T1* t =
reinterpret_cast<T1*
>(first);
133 inline void get(std::complex<T>& x)
140 inline void get(T1& x)
145 template<
class _OutputIterator>
146 inline void get(_OutputIterator first, _OutputIterator last)
153 template<
typename T1>
154 inline void get(T1* first, T1* last)
161 template<
typename T1>
162 inline void get(std::complex<T1>* first, std::complex<T1>* last)
164 while (first != last)
174 inline void put(std::complex<T>& x)
180 template<
typename T1>
186 template<
class _InputIterator>
187 inline void put(_InputIterator first, _InputIterator last)
193 template<
typename T1>
194 inline void put(T1* first, T1* last)
200 template<
typename T1>
201 inline void put(std::complex<T1>* first, std::complex<T1>* last)
203 while (first != last)
232 for (
int i = 0; i <
myData.size(); ++i)
238 for (
int i = 0; i <
myData.size(); ++i)
253 if (
std::abs(a[i] - b[i]) > std::numeric_limits<T>::epsilon())
268 if (
std::abs(a[i] - b[i]) > std::numeric_limits<T>::epsilon())
size_type size() const
return the size of the data
void add(T1 *first, T1 *last)
void add(std::complex< T1 > *first, std::complex< T1 > *last)
void put(T1 *first, T1 *last)
void put(_InputIterator first, _InputIterator last)
T * data()
return the address of the first element
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
std::vector< T >::iterator end()
return the ending iterator
PooledData< T > & operator*=(T scale)
void put(std::complex< T1 > *first, std::complex< T1 > *last)
std::vector< T >::iterator begin()
return the starting iterator
void rewind(size_type cur=0)
set the Current to a cursor
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
void add(std::complex< T > &x)
void clear()
clear the data and set Current=0
PooledData(size_type n)
constructor with a size
size_type current() const
T & operator[](size_type i)
return i-th value to assign
void add(_InputIterator first, _InputIterator last)
void resize(size_type n, T val=T())
resize
size_type byteSize() const
return the size of the data
T operator[](size_type i) const
return i-th value
void reserve(size_type n)
reserve the memory using std::vector<T>::reserve
bool operator==(const PooledData< T > &a, const PooledData< T > &b)
operator to check if two buffers are identical
PooledData()
default constructor
void print(std::ostream &os)
typename std::vector< T >::size_type size_type
void put(std::complex< T > &x)
bool operator!=(const PooledData< T > &a, const PooledData< T > &b)
operator to check if two buffers are different
PooledData< T > & operator+=(const PooledData< T > &s)