QMCPACK
OhmmsMatrix.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2021 QMCPACK developers.
6 //
7 // File developed by: Ken Esler, kpesler@gmail.com, University of Illinois at Urbana-Champaign
8 // Miguel Morales, moralessilva2@llnl.gov, Lawrence Livermore National Laboratory
9 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
10 // Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
11 //
12 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
13 //////////////////////////////////////////////////////////////////////////////////////
14 
15 #ifndef OHMMS_PETE_MATRIX_H
16 #define OHMMS_PETE_MATRIX_H
17 
18 #include <cstdlib>
19 #include <type_traits>
20 #include <iostream>
21 #include "PETE/PETE.h"
22 #include "OhmmsVector.h"
23 
24 namespace qmcplusplus
25 {
26 template<class T, typename Alloc = std::allocator<T>>
27 class Matrix
28 {
29 public:
30  using Type_t = T;
31  using value_type = T;
32  using pointer = T*;
33  using const_pointer = const T*;
36  using iterator = typename Container_t::iterator;
38 
39  Matrix() : D1(0), D2(0), TotSize(0) {} // Default Constructor initializes to zero.
40 
42  {
43  resize(n, n);
44  //assign(*this, T());
45  }
46 
48  {
49  resize(n, m);
50  //assign(*this, T());
51  }
52 
53  /** constructor with an initialized ref */
54  inline Matrix(T* ref, size_type n, size_type m) : D1(n), D2(m), TotSize(n * m), X(ref, n * m) {}
55 
56  /** This allows construction of a Matrix on another containers owned memory that is using a dualspace allocator.
57  * It can be any span of that memory.
58  * You're going to get a bunch of compile errors if the Container in questions is not using a the QMCPACK
59  * realspace dualspace allocator "interface"
60  */
61  template<typename CONTAINER>
62  Matrix(const CONTAINER& other, T* ref, size_type n, size_type m) : D1(n), D2(m), TotSize(n * m), X(other, ref, n * m)
63  {}
64 
65  // Copy Constructor
66  Matrix(const This_t& rhs)
67  {
68  resize(rhs.D1, rhs.D2);
70  assign(*this, rhs);
71  }
72 
73  // Destructor
74  ~Matrix() {}
75 
76  inline size_type size() const { return TotSize; }
77  inline size_type rows() const { return D1; }
78  inline size_type cols() const { return D2; }
79  inline size_type size1() const { return D1; }
80  inline size_type size2() const { return D2; }
81  inline size_type size(int i) const { return (i == 0) ? D1 : D2; }
82  inline size_type extent(int i) const { return (i == 0) ? D1 : D2; }
83 
84  // inline const T* begin() const { return X.begin();}
85  // inline T* begin() { return X.begin();}
86  // inline const T* end() const { return X.end();}
87  // inline T* end() { return X.end();}
88 
89  inline typename Container_t::iterator begin() { return X.begin(); }
90  inline typename Container_t::iterator end() { return X.end(); }
91  inline typename Container_t::const_iterator begin() const { return X.begin(); }
92  inline typename Container_t::const_iterator end() const { return X.end(); }
93 
94  inline typename Container_t::iterator begin(int i) { return X.begin() + i * D2; }
95  inline typename Container_t::const_iterator begin(int i) const { return X.begin() + i * D2; }
96 
97  /// Resize the container. For performance consideration, previous data may or may not get kept.
98  /// Please avoid relying on previous data after resizing.
99  inline void resize(size_type n, size_type m)
100  {
101  static_assert(std::is_same<value_type, typename Alloc::value_type>::value,
102  "Matrix and Alloc data types must agree!");
103  D1 = n;
104  D2 = m;
105  TotSize = n * m;
106  X.resize(n * m);
107  }
108 
109  // free the matrix storage
110  inline void free() { X.free(); }
111 
112  // Attach to pre-allocated memory
113  inline void attachReference(T* ref) { X.attachReference(ref, TotSize); }
114 
115  inline void attachReference(T* ref, size_type n, size_type m)
116  {
117  D1 = n;
118  D2 = m;
119  TotSize = n * m;
120  X.attachReference(ref, TotSize);
121  }
122 
123  /** Attach to pre-allocated memory and propagate the allocator of the owning container.
124  * Required for sane access to dual space memory
125  */
126  template<typename CONTAINER>
127  inline void attachReference(const CONTAINER& other, T* ref, size_type n, size_type m)
128  {
129  D1 = n;
130  D2 = m;
131  TotSize = n * m;
132  X.attachReference(other, ref, TotSize);
133  }
134 
135  template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
136  inline void add(size_type n) // you can add rows: adding columns are forbidden
137  {
138  X.insert(X.end(), n * D2, T());
139  D1 += n;
140  }
141 
142  template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
143  inline void copy(const This_t& rhs)
144  {
145  resize(rhs.D1, rhs.D2);
146  assign(*this, rhs);
147  }
148 
149  /** This assigns from a matrix with larger row size (used for alignment)
150  * to whatever the rowsize is here.
151  * Hacky but so is just making the matrix n x (n + padding) to handle row alignment.
152  * This is unoptimized.
153  */
154  template<class T_FROM, typename ALLOC_FROM>
156  {
157  auto& this_ref = *this;
158  const size_type cols = std::min(this_ref.cols(), from.cols());
159  const size_type rows = std::min(this_ref.rows(), from.rows());
160  for (int i = 0; i < rows; ++i)
161  for (int j = 0; j < cols; ++j)
162  this_ref(i, j) = from(i, j);
163  }
164 
165  // Assignment Operators
166  inline This_t& operator=(const This_t& rhs)
167  {
168  resize(rhs.D1, rhs.D2);
170  assign(*this, rhs);
171  return *this;
172  }
173 
174  template<class RHS, typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
175  This_t& operator=(const RHS& rhs)
176  {
177  return assign(*this, rhs);
178  }
179 
180  // Get and Set Operations for assignment operators
181  // returns a pointer of i-th row
182  inline pointer data() { return X.data(); }
183 
184  // returns a pointer of i-th row
185  inline const_pointer data() const { return X.data(); }
186 
187  template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
189  {
190  return X.device_data();
191  }
192  template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
193  inline const_pointer device_data() const
194  {
195  return X.device_data();
196  }
197 
198  // returns a const pointer of i-th row
199  inline const Type_t* data(size_type i) const { return X.data() + i * D2; }
200 
201  /// returns a pointer of i-th row, g++ iterator problem
202  inline Type_t* data(size_type i) { return X.data() + i * D2; }
203 
204  inline pointer first_address() { return X.data(); }
205 
206  // returns a pointer of i-th row
207  inline const_pointer first_address() const { return X.data(); }
208 
209  inline pointer last_address() { return X.data() + TotSize; }
210 
211  // returns a pointer of i-th row
212  inline const Type_t* last_address() const { return X.data() + TotSize; }
213 
214 
215  // returns a const pointer of i-th row
216  inline const Type_t* operator[](size_type i) const { return X.data() + i * D2; }
217 
218  /// returns a pointer of i-th row, g++ iterator problem
219  inline Type_t* operator[](size_type i) { return X.data() + i * D2; }
220 
221  template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
223  {
224  return X[i];
225  }
226 
227  // returns the i-th value in D1*D2 vector
228  template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
229  inline Type_t operator()(size_type i) const
230  {
231  return X[i];
232  }
233 
234  // returns val(i,j)
235  template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
237  {
238  return X[i * D2 + j];
239  }
240 
241  // returns val(i,j)
242  template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
243  inline const Type_t& operator()(size_type i, size_type j) const
244  {
245  return X[i * D2 + j];
246  }
247 
248  template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
249  inline void swap_rows(int r1, int r2)
250  {
251  for (int col = 0; col < D2; col++)
252  {
253  Type_t tmp = (*this)(r1, col);
254  (*this)(r1, col) = (*this)(r2, col);
255  (*this)(r2, col) = tmp;
256  }
257  }
258 
259  template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
260  inline void swap_cols(int c1, int c2)
261  {
262  for (int row = 0; row < D1; row++)
263  {
264  Type_t tmp = (*this)(row, c1);
265  (*this)(row, c1) = (*this)(row, c2);
266  (*this)(row, c2) = tmp;
267  }
268  }
269 
270  template<class IT, typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
271  inline void replaceRow(IT first, size_type i)
272  {
273  std::copy(first, first + D2, X.begin() + i * D2);
274  }
275 
276  template<class IT, typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
277  inline void replaceColumn(IT first, size_type j)
278  {
279  typename Container_t::iterator ii(X.begin() + j);
280  for (int i = 0; i < D1; i++, ii += D2)
281  *ii = *first++;
282  }
283 
284  template<class IT, typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
285  inline void add2Column(IT first, size_type j)
286  {
287  typename Container_t::iterator ii(X.begin() + j);
288  for (int i = 0; i < D1; i++, ii += D2)
289  *ii += *first++;
290  }
291 
292  /**
293  * \param sub an input array to be copied
294  * \param d1 row-dimension of the input array
295  * \param d2 column-dimension of the input array
296  * \param i0 starting row where the copying is done
297  * \param j0 starting column where the copying is done
298  */
299  template<class T1, typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
300  inline void add(const T1* sub, size_type d1, size_type d2, size_type i0, size_type j0)
301  {
302  int ii = 0;
303  for (int i = 0; i < d1; i++)
304  {
305  int kk = (i0 + i) * D2 + j0;
306  for (int j = 0; j < d2; j++)
307  {
308  X[kk++] += sub[ii++];
309  }
310  }
311  }
312 
313  template<class T1, typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
314  inline void add(const T1* sub, size_type d1, size_type d2, size_type i0, size_type j0, const T& phi)
315  {
316  size_type ii = 0;
317  for (size_type i = 0; i < d1; i++)
318  {
319  int kk = (i0 + i) * D2 + j0;
320  for (size_type j = 0; j < d2; j++)
321  {
322  X[kk++] += phi * sub[ii++];
323  }
324  }
325  }
326 
327  template<class SubMat_t, typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
328  inline void add(const SubMat_t& sub, unsigned int i0, unsigned int j0)
329  {
330  size_type ii = 0;
331  for (size_type i = 0; i < sub.rows(); i++)
332  {
333  int kk = (i0 + i) * D2 + j0;
334  for (size_type j = 0; j < sub.cols(); j++)
335  {
336  X[kk++] += sub(ii++);
337  }
338  }
339  }
340 
341  template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
342  inline void add(const This_t& sub, unsigned int i0, unsigned int j0)
343  {
344  size_type ii = 0;
345  for (size_type i = 0; i < sub.rows(); i++)
346  {
347  int kk = (i0 + i) * D2 + j0;
348  for (size_type j = 0; j < sub.cols(); j++)
349  {
350  X[kk++] += sub[ii++];
351  }
352  }
353  }
354 
355  template<class Msg, typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
356  inline Msg& putMessage(Msg& m)
357  {
358  m.Pack(X.data(), D1 * D2);
359  return m;
360  }
361 
362  template<class Msg, typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
363  inline Msg& getMessage(Msg& m)
364  {
365  m.Unpack(X.data(), D1 * D2);
366  return m;
367  }
368 
369  // Abstract Dual Space Transfers
370  template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
371  void updateTo(size_type size = 0, std::ptrdiff_t offset = 0)
372  {
373  X.updateTo(size, offset);
374  }
375  template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
376  void updateFrom(size_type size = 0, std::ptrdiff_t offset = 0)
377  {
378  X.updateFrom(size, offset);
379  }
380 
381 protected:
385 };
386 
387 template<class T, class Alloc>
388 bool operator==(const Matrix<T, Alloc>& lhs, const Matrix<T, Alloc>& rhs)
389 {
390  static_assert(qmc_allocator_traits<Alloc>::is_host_accessible, "operator== requires host accessible Vector.");
391  if (lhs.size() == rhs.size())
392  {
393  for (int i = 0; i < rhs.size(); i++)
394  if (lhs(i) != rhs(i))
395  return false;
396  return true;
397  }
398  else
399  return false;
400 }
401 
402 template<class T, class Alloc>
403 bool operator!=(const Matrix<T, Alloc>& lhs, const Matrix<T, Alloc>& rhs)
404 {
405  static_assert(qmc_allocator_traits<Alloc>::is_host_accessible, "operator== requires host accessible Vector.");
406  return !(lhs == rhs);
407 }
408 
409 
410 // I/O
411 template<class T, typename Alloc>
412 std::ostream& operator<<(std::ostream& out, const Matrix<T, Alloc>& rhs)
413 {
414  using size_type = typename Matrix<T, Alloc>::size_type;
415  size_type ii = 0;
416  for (size_type i = 0; i < rhs.rows(); i++)
417  {
418  for (size_type j = 0; j < rhs.cols(); j++)
419  out << rhs(ii++) << " ";
420  out << std::endl;
421  }
422  return out;
423 }
424 
425 
426 template<class T, typename Alloc>
427 std::istream& operator>>(std::istream& is, Matrix<T, Alloc>& rhs)
428 {
429  using size_type = typename Matrix<T, Alloc>::size_type;
430  for (size_type i = 0; i < rhs.size(); i++)
431  {
432  is >> rhs(i++);
433  }
434  return is;
435 }
436 //-----------------------------------------------------------------------------
437 // We need to specialize CreateLeaf<T> for our class, so that operators
438 // know what to stick in the leaves of the expression tree.
439 //-----------------------------------------------------------------------------
440 template<class T, typename Alloc>
441 struct CreateLeaf<Matrix<T, Alloc>>
442 {
444  inline static Leaf_t make(const Matrix<T, Alloc>& a) { return Leaf_t(a); }
445 };
446 
447 //-----------------------------------------------------------------------------
448 // We need to write a functor that is capable of comparing the size of
449 // the vector with a stored value. Then, we supply LeafFunctor specializations
450 // for Scalar<T> and STL vector leaves.
451 //-----------------------------------------------------------------------------
453 {
454 public:
455  using size_type = int;
456 
458  SizeLeaf2(const SizeLeaf2& model) : size_m(model.size_m), size_n(model.size_n) {}
459 
460  bool operator()(size_type s, size_type p) const { return ((size_m == s) && (size_n == p)); }
461 
462 private:
464 };
465 
466 template<class T>
468 {
469  using Type_t = bool;
470  inline static bool apply(const Scalar<T>&, const SizeLeaf2&)
471  {
472  // Scalars always conform.
473  return true;
474  }
475 };
476 
477 template<class T, typename Alloc>
478 struct LeafFunctor<Matrix<T, Alloc>, SizeLeaf2>
479 {
480  using Type_t = bool;
481  inline static bool apply(const Matrix<T, Alloc>& v, const SizeLeaf2& s) { return s(v.rows(), v.cols()); }
482 };
483 
484 //-----------------------------------------------------------------------------
485 // EvalLeaf1 is used to evaluate expression with matrices.
486 // (It's already defined for Scalar values.)
487 //-----------------------------------------------------------------------------
488 // template<class T, typename Alloc>
489 // struct LeafFunctor<Matrix<T,Alloc>,EvalLeaf1>
490 // {
491 // using Type_t = T;
492 // inline static
493 // Type_t apply(const Matrix<T,Alloc>& mat, const EvalLeaf1 &f)
494 // {
495 // return vec[f.val1()];
496 // }
497 // };
498 //-----------------------------------------------------------------------------
499 // EvalLeaf2 is used to evaluate expression with matrices.
500 // (It's already defined for Scalar values.)
501 //-----------------------------------------------------------------------------
502 template<class T, typename Alloc>
503 struct LeafFunctor<Matrix<T, Alloc>, EvalLeaf2>
504 {
505  using Type_t = T;
506  inline static Type_t apply(const Matrix<T, Alloc>& mat, const EvalLeaf2& f) { return mat(f.val1(), f.val2()); }
507 };
508 
509 
510 ///////////////////////////////////////////////////////////////////////////////
511 // LOOP is done by evaluate function
512 ///////////////////////////////////////////////////////////////////////////////
513 template<class T, typename Alloc, class Op, class RHS>
514 inline void evaluate(Matrix<T, Alloc>& lhs, const Op& op, const Expression<RHS>& rhs)
515 {
516  if (forEach(rhs, SizeLeaf2(lhs.rows(), lhs.cols()), AndCombine()))
517  {
518  // We get here if the vectors on the RHS are the same size as those on
519  // the LHS.
520  for (int i = 0; i < lhs.rows(); ++i)
521  {
522  for (int j = 0; j < lhs.cols(); ++j)
523  {
524  op(lhs(i, j), forEach(rhs, EvalLeaf2(i, j), OpCombine()));
525  }
526  }
527  }
528  else
529  {
530  throw std::runtime_error("Error in evaluate: LHS and RHS don't conform in OhmmsMatrix.");
531  }
532 }
533 } // namespace qmcplusplus
534 
536 
537 #endif // OHMMS_PETE_MATRIX_H
void resize(size_type n, Type_t val=Type_t())
Resize the container.
Definition: OhmmsVector.h:166
Container_t::iterator begin(int i)
Definition: OhmmsMatrix.h:94
void add(const This_t &sub, unsigned int i0, unsigned int j0)
Definition: OhmmsMatrix.h:342
Type_t operator()(size_type i) const
Definition: OhmmsMatrix.h:229
Container_t::iterator begin()
Definition: OhmmsMatrix.h:89
size_type size1() const
Definition: OhmmsMatrix.h:79
const Type_t * data(size_type i) const
Definition: OhmmsMatrix.h:199
Container_t::const_iterator begin() const
Definition: OhmmsMatrix.h:91
This_t & operator=(const RHS &rhs)
Definition: OhmmsMatrix.h:175
static bool apply(const Matrix< T, Alloc > &v, const SizeLeaf2 &s)
Definition: OhmmsMatrix.h:481
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
static Type_t apply(const Matrix< T, Alloc > &mat, const EvalLeaf2 &f)
Definition: OhmmsMatrix.h:506
pointer last_address()
Definition: OhmmsMatrix.h:209
void attachReference(const CONTAINER &other, T *ref, size_type n, size_type m)
Attach to pre-allocated memory and propagate the allocator of the owning container.
Definition: OhmmsMatrix.h:127
const_pointer first_address() const
Definition: OhmmsMatrix.h:207
Definition: Scalar.h:49
static bool apply(const Scalar< T > &, const SizeLeaf2 &)
Definition: OhmmsMatrix.h:470
Matrix(const CONTAINER &other, T *ref, size_type n, size_type m)
This allows construction of a Matrix on another containers owned memory that is using a dualspace all...
Definition: OhmmsMatrix.h:62
ForEach< Expr, FTag, CTag >::Type_t forEach(const Expr &e, const FTag &f, const CTag &c)
Definition: ForEach.h:87
Matrix(size_type n, size_type m)
Definition: OhmmsMatrix.h:47
int val1() const
Definition: Functors.h:114
pointer device_data()
Return the device_ptr matching X if this is a vector attached or owning dual space memory...
Definition: OhmmsVector.h:245
void add(const T1 *sub, size_type d1, size_type d2, size_type i0, size_type j0, const T &phi)
Definition: OhmmsMatrix.h:314
void updateFrom(size_type size=0, std::ptrdiff_t offset=0)
Definition: OhmmsVector.h:272
void swap_rows(int r1, int r2)
Definition: OhmmsMatrix.h:249
void updateFrom(size_type size=0, std::ptrdiff_t offset=0)
Definition: OhmmsMatrix.h:376
bool operator==(const Matrix< T, Alloc > &lhs, const Matrix< T, Alloc > &rhs)
Definition: OhmmsMatrix.h:388
Container_t::const_iterator end() const
Definition: OhmmsMatrix.h:92
void free()
free
Definition: OhmmsVector.h:196
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99
SizeLeaf2(size_type s, size_type p)
Definition: OhmmsMatrix.h:457
Type_t * operator[](size_type i)
returns a pointer of i-th row, g++ iterator problem
Definition: OhmmsMatrix.h:219
SizeLeaf2(const SizeLeaf2 &model)
Definition: OhmmsMatrix.h:458
Container_t::const_iterator begin(int i) const
Definition: OhmmsMatrix.h:95
Msg & getMessage(Msg &m)
Definition: OhmmsMatrix.h:363
Type_t * data(size_type i)
returns a pointer of i-th row, g++ iterator problem
Definition: OhmmsMatrix.h:202
void copy(const This_t &rhs)
Definition: OhmmsMatrix.h:143
T min(T a, T b)
const Type_t * operator[](size_type i) const
Definition: OhmmsMatrix.h:216
size_type cols() const
Definition: OhmmsMatrix.h:78
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Definition: Blitz.h:639
size_type extent(int i) const
Definition: OhmmsMatrix.h:82
void swap_cols(int c1, int c2)
Definition: OhmmsMatrix.h:260
void attachReference(T *ref, size_type n)
Definition: OhmmsVector.h:131
size_type size() const
Definition: OhmmsMatrix.h:76
void updateTo(size_type size=0, std::ptrdiff_t offset=0)
Definition: OhmmsMatrix.h:371
Matrix(size_type n)
Definition: OhmmsMatrix.h:41
bool operator()(size_type s, size_type p) const
Definition: OhmmsMatrix.h:460
void assignUpperLeft(const Matrix< T_FROM, ALLOC_FROM > &from)
This assigns from a matrix with larger row size (used for alignment) to whatever the rowsize is here...
Definition: OhmmsMatrix.h:155
Type_t & operator()(size_type i, size_type j)
Definition: OhmmsMatrix.h:236
Msg & putMessage(Msg &m)
Definition: OhmmsMatrix.h:356
void replaceRow(IT first, size_type i)
Definition: OhmmsMatrix.h:271
static Leaf_t make(const Matrix< T, Alloc > &a)
Definition: OhmmsMatrix.h:444
Matrix< T1, C1 > & assign(Matrix< T1, C1 > &lhs, const RHS &rhs)
Matrix(T *ref, size_type n, size_type m)
constructor with an initialized ref
Definition: OhmmsMatrix.h:54
pointer first_address()
Definition: OhmmsMatrix.h:204
const_pointer device_data() const
Definition: OhmmsMatrix.h:193
This_t & operator=(const This_t &rhs)
Definition: OhmmsMatrix.h:166
template class analogous to std::allocator_traits.
int val2() const
Definition: Functors.h:115
size_type rows() const
Definition: OhmmsMatrix.h:77
pointer device_data()
Definition: OhmmsMatrix.h:188
Matrix(const This_t &rhs)
Definition: OhmmsMatrix.h:66
const_pointer data() const
Definition: OhmmsMatrix.h:185
void attachReference(T *ref)
Definition: OhmmsMatrix.h:113
Declaraton of Vector<T,Alloc> Manage memory through Alloc directly and allow referencing an existing ...
const Type_t * last_address() const
Definition: OhmmsMatrix.h:212
size_type size2() const
Definition: OhmmsMatrix.h:80
void attachReference(T *ref, size_type n, size_type m)
Definition: OhmmsMatrix.h:115
const Type_t & operator()(size_type i, size_type j) const
Definition: OhmmsMatrix.h:243
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514
void updateTo(size_type size=0, std::ptrdiff_t offset=0)
Definition: OhmmsVector.h:263
void add(const T1 *sub, size_type d1, size_type d2, size_type i0, size_type j0)
Definition: OhmmsMatrix.h:300
std::istream & operator>>(std::istream &is, Matrix< T, Alloc > &rhs)
Definition: OhmmsMatrix.h:427
void add(const SubMat_t &sub, unsigned int i0, unsigned int j0)
Definition: OhmmsMatrix.h:328
Container_t::iterator end()
Definition: OhmmsMatrix.h:90
typename Alloc::size_type size_type
Definition: OhmmsVector.h:40
void add(size_type n)
Definition: OhmmsMatrix.h:136
void replaceColumn(IT first, size_type j)
Definition: OhmmsMatrix.h:277
size_type size(int i) const
Definition: OhmmsMatrix.h:81
Type_t & operator()(size_type i)
Definition: OhmmsMatrix.h:222
bool operator!=(const Matrix< T, Alloc > &lhs, const Matrix< T, Alloc > &rhs)
Definition: OhmmsMatrix.h:403
void add2Column(IT first, size_type j)
Definition: OhmmsMatrix.h:285