QMCPACK
Matrix< T, Alloc > Class Template Reference
+ Inheritance diagram for Matrix< T, Alloc >:
+ Collaboration diagram for Matrix< T, Alloc >:

Public Types

using Type_t = T
 
using value_type = T
 
using pointer = T *
 
using const_pointer = const T *
 
using Container_t = Vector< T, Alloc >
 
using size_type = typename Container_t::size_type
 
using iterator = typename Container_t::iterator
 
using This_t = Matrix< T, Alloc >
 

Public Member Functions

 Matrix ()
 
 Matrix (size_type n)
 
 Matrix (size_type n, size_type m)
 
 Matrix (T *ref, size_type n, size_type m)
 constructor with an initialized ref More...
 
template<typename CONTAINER >
 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 allocator. More...
 
 Matrix (const This_t &rhs)
 
 ~Matrix ()
 
size_type size () const
 
size_type rows () const
 
size_type cols () const
 
size_type size1 () const
 
size_type size2 () const
 
size_type size (int i) const
 
size_type extent (int i) const
 
Container_t::iterator begin ()
 
Container_t::iterator end ()
 
Container_t::const_iterator begin () const
 
Container_t::const_iterator end () const
 
Container_t::iterator begin (int i)
 
Container_t::const_iterator begin (int i) const
 
void resize (size_type n, size_type m)
 Resize the container. More...
 
void free ()
 
void attachReference (T *ref)
 
void attachReference (T *ref, size_type n, size_type m)
 
template<typename CONTAINER >
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. More...
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
void add (size_type n)
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
void copy (const This_t &rhs)
 
template<class T_FROM , typename ALLOC_FROM >
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. More...
 
This_toperator= (const This_t &rhs)
 
template<class RHS , typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
This_toperator= (const RHS &rhs)
 
pointer data ()
 
const_pointer data () const
 
template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
pointer device_data ()
 
template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
const_pointer device_data () const
 
const Type_tdata (size_type i) const
 
Type_tdata (size_type i)
 returns a pointer of i-th row, g++ iterator problem More...
 
pointer first_address ()
 
const_pointer first_address () const
 
pointer last_address ()
 
const Type_tlast_address () const
 
const Type_toperator[] (size_type i) const
 
Type_toperator[] (size_type i)
 returns a pointer of i-th row, g++ iterator problem More...
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
Type_toperator() (size_type i)
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
Type_t operator() (size_type i) const
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
Type_toperator() (size_type i, size_type j)
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
const Type_toperator() (size_type i, size_type j) const
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
void swap_rows (int r1, int r2)
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
void swap_cols (int c1, int c2)
 
template<class IT , typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
void replaceRow (IT first, size_type i)
 
template<class IT , typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
void replaceColumn (IT first, size_type j)
 
template<class IT , typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
void add2Column (IT first, size_type j)
 
template<class T1 , typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
void add (const T1 *sub, size_type d1, size_type d2, size_type i0, size_type j0)
 
template<class T1 , typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
void add (const T1 *sub, size_type d1, size_type d2, size_type i0, size_type j0, const T &phi)
 
template<class SubMat_t , typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
void add (const SubMat_t &sub, unsigned int i0, unsigned int j0)
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
void add (const This_t &sub, unsigned int i0, unsigned int j0)
 
template<class Msg , typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
Msg & putMessage (Msg &m)
 
template<class Msg , typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
Msg & getMessage (Msg &m)
 
template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
void updateTo (size_type size=0, std::ptrdiff_t offset=0)
 
template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
void updateFrom (size_type size=0, std::ptrdiff_t offset=0)
 

Protected Attributes

size_type D1
 
size_type D2
 
size_type TotSize
 
Container_t X
 

Detailed Description

template<class T, typename Alloc = std::allocator<T>>
class qmcplusplus::Matrix< T, Alloc >

Definition at line 27 of file OhmmsMatrix.h.

Member Typedef Documentation

◆ const_pointer

using const_pointer = const T*

Definition at line 33 of file OhmmsMatrix.h.

◆ Container_t

using Container_t = Vector<T, Alloc>

Definition at line 34 of file OhmmsMatrix.h.

◆ iterator

using iterator = typename Container_t::iterator

Definition at line 36 of file OhmmsMatrix.h.

◆ pointer

using pointer = T*

Definition at line 32 of file OhmmsMatrix.h.

◆ size_type

Definition at line 35 of file OhmmsMatrix.h.

◆ This_t

using This_t = Matrix<T, Alloc>

Definition at line 37 of file OhmmsMatrix.h.

◆ Type_t

using Type_t = T

Definition at line 30 of file OhmmsMatrix.h.

◆ value_type

using value_type = T

Definition at line 31 of file OhmmsMatrix.h.

Constructor & Destructor Documentation

◆ Matrix() [1/6]

Matrix ( )
inline

Definition at line 39 of file OhmmsMatrix.h.

39 : D1(0), D2(0), TotSize(0) {} // Default Constructor initializes to zero.

◆ Matrix() [2/6]

Matrix ( size_type  n)
inline

Definition at line 41 of file OhmmsMatrix.h.

42  {
43  resize(n, n);
44  //assign(*this, T());
45  }
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99

◆ Matrix() [3/6]

Matrix ( size_type  n,
size_type  m 
)
inline

Definition at line 47 of file OhmmsMatrix.h.

48  {
49  resize(n, m);
50  //assign(*this, T());
51  }
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99

◆ Matrix() [4/6]

Matrix ( T *  ref,
size_type  n,
size_type  m 
)
inline

constructor with an initialized ref

Definition at line 54 of file OhmmsMatrix.h.

54 : D1(n), D2(m), TotSize(n * m), X(ref, n * m) {}

◆ Matrix() [5/6]

Matrix ( const CONTAINER &  other,
T *  ref,
size_type  n,
size_type  m 
)
inline

This allows construction of a Matrix on another containers owned memory that is using a dualspace allocator.

It can be any span of that memory. You're going to get a bunch of compile errors if the Container in questions is not using a the QMCPACK realspace dualspace allocator "interface"

Definition at line 62 of file OhmmsMatrix.h.

62  : D1(n), D2(m), TotSize(n * m), X(other, ref, n * m)
63  {}

◆ Matrix() [6/6]

Matrix ( const This_t rhs)
inline

Definition at line 66 of file OhmmsMatrix.h.

67  {
68  resize(rhs.D1, rhs.D2);
70  assign(*this, rhs);
71  }
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99
Matrix< T1, C1 > & assign(Matrix< T1, C1 > &lhs, const RHS &rhs)
static constexpr bool is_host_accessible

◆ ~Matrix()

~Matrix ( )
inline

Definition at line 74 of file OhmmsMatrix.h.

74 {}

Member Function Documentation

◆ add() [1/5]

void add ( size_type  n)
inline

Definition at line 136 of file OhmmsMatrix.h.

137  {
138  X.insert(X.end(), n * D2, T());
139  D1 += n;
140  }

◆ add() [2/5]

void add ( const T1 *  sub,
size_type  d1,
size_type  d2,
size_type  i0,
size_type  j0 
)
inline
Parameters
suban input array to be copied
d1row-dimension of the input array
d2column-dimension of the input array
i0starting row where the copying is done
j0starting column where the copying is done

Definition at line 300 of file OhmmsMatrix.h.

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  }

◆ add() [3/5]

void add ( const T1 *  sub,
size_type  d1,
size_type  d2,
size_type  i0,
size_type  j0,
const T &  phi 
)
inline

Definition at line 314 of file OhmmsMatrix.h.

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  }
typename Container_t::size_type size_type
Definition: OhmmsMatrix.h:35

◆ add() [4/5]

void add ( const SubMat_t &  sub,
unsigned int  i0,
unsigned int  j0 
)
inline

Definition at line 328 of file OhmmsMatrix.h.

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  }
typename Container_t::size_type size_type
Definition: OhmmsMatrix.h:35

◆ add() [5/5]

void add ( const This_t sub,
unsigned int  i0,
unsigned int  j0 
)
inline

Definition at line 342 of file OhmmsMatrix.h.

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  }
typename Container_t::size_type size_type
Definition: OhmmsMatrix.h:35

◆ add2Column()

void add2Column ( IT  first,
size_type  j 
)
inline

Definition at line 285 of file OhmmsMatrix.h.

286  {
287  typename Container_t::iterator ii(X.begin() + j);
288  for (int i = 0; i < D1; i++, ii += D2)
289  *ii += *first++;
290  }

◆ assignUpperLeft()

void assignUpperLeft ( const Matrix< T_FROM, ALLOC_FROM > &  from)
inline

This assigns from a matrix with larger row size (used for alignment) to whatever the rowsize is here.

Hacky but so is just making the matrix n x (n + padding) to handle row alignment. This is unoptimized.

Definition at line 155 of file OhmmsMatrix.h.

Referenced by DiracMatrixComputeCUDA< VALUE_FP >::invert_transpose(), and qmcplusplus::TEST_CASE().

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  }
typename Container_t::size_type size_type
Definition: OhmmsMatrix.h:35
T min(T a, T b)
size_type cols() const
Definition: OhmmsMatrix.h:78
size_type rows() const
Definition: OhmmsMatrix.h:77

◆ attachReference() [1/3]

void attachReference ( T *  ref)
inline

◆ attachReference() [2/3]

void attachReference ( T *  ref,
size_type  n,
size_type  m 
)
inline

Definition at line 115 of file OhmmsMatrix.h.

116  {
117  D1 = n;
118  D2 = m;
119  TotSize = n * m;
120  X.attachReference(ref, TotSize);
121  }
void attachReference(T *ref, size_type n)
Definition: OhmmsVector.h:131

◆ attachReference() [3/3]

void attachReference ( const CONTAINER &  other,
T *  ref,
size_type  n,
size_type  m 
)
inline

Attach to pre-allocated memory and propagate the allocator of the owning container.

Required for sane access to dual space memory

Definition at line 127 of file OhmmsMatrix.h.

128  {
129  D1 = n;
130  D2 = m;
131  TotSize = n * m;
132  X.attachReference(other, ref, TotSize);
133  }
void attachReference(T *ref, size_type n)
Definition: OhmmsVector.h:131

◆ begin() [1/4]

◆ begin() [2/4]

Container_t::const_iterator begin ( ) const
inline

Definition at line 91 of file OhmmsMatrix.h.

91 { return X.begin(); }

◆ begin() [3/4]

Container_t::iterator begin ( int  i)
inline

Definition at line 94 of file OhmmsMatrix.h.

94 { return X.begin() + i * D2; }

◆ begin() [4/4]

Container_t::const_iterator begin ( int  i) const
inline

Definition at line 95 of file OhmmsMatrix.h.

95 { return X.begin() + i * D2; }

◆ cols()

size_type cols ( ) const
inline

Definition at line 78 of file OhmmsMatrix.h.

Referenced by Backflow_eI< FT >::acceptMove(), Backflow_eI_spin< FT >::acceptMove(), DelayedUpdate< T, T_FP >::acceptRow(), DelayedUpdateSYCL< T, T_FP >::acceptRow(), CSEnergyEstimator::accumulate(), Matrix< ST, qmcplusplus::Mallocator< ST > >::add(), MultiQuinticSpline1D< T >::add_spline(), Backflow_eI_spin< FT >::addFunc(), LeafFunctor< Matrix< T, Alloc >, SizeLeaf2 >::apply(), qmcplusplus::applyCuspCorrection(), Matrix< ST, qmcplusplus::Mallocator< ST > >::assignUpperLeft(), MultiQuinticSpline1D< T >::batched_evaluate(), MultiQuinticSpline1D< T >::batched_evaluateVGL(), ECPComponentBuilder::buildSO(), qmcplusplus::check_force_copy(), qmcplusplus::check_matrix(), DensityMatrices1B::compare(), LRBreakup< BreakupBasis >::DoAllBreakup(), LRBreakup< BreakupBasis >::DoBreakup(), ECPComponentBuilder::doBreakUp(), LRBreakup< BreakupBasis >::DoGradBreakup(), qmcplusplus::doSOECPotentialTest(), LRBreakup< BreakupBasis >::DoStrainBreakup(), StaticStructureFactor::evaluate(), qmcplusplus::evaluate(), MultiDiracDeterminant::evaluateDerivatives(), MultiDiracDeterminant::evaluateDerivativesWF(), qmcplusplus::generateCuspInfo(), DelayedUpdate< T, T_FP >::getInvRow(), DelayedUpdateSYCL< T, T_FP >::getInvRow(), qmcplusplus::testing::getParticularListener(), qmcplusplus::testing::getSummingListener(), h5data_proxy< Matrix< T > >::h5data_proxy(), qmcplusplus::InverseUpdateByRow(), DiracMatrixComputeOMPTarget< VALUE_FP >::invert_transpose(), DiracMatrix< VALUE_FP >::invert_transpose(), DiracMatrixComputeCUDA< VALUE_FP >::invert_transpose(), LCAOrbitalBuilder::LoadFullCoefsFromH5(), qmcplusplus::testing::makeRngSpdMatrix(), DelayedUpdateBatched< PL, VALUE >::mw_accept_rejectRow(), MultiDiracDeterminant::mw_buildTableMatrix_calculateGradRatios(), DelayedUpdateBatched< PL, VALUE >::mw_evalGrad(), DelayedUpdateBatched< PL, VALUE >::mw_evalGradWithSpin(), SpinorSet::mw_evaluateVGLWithSpin(), DelayedUpdateBatched< PL, VALUE >::mw_prepareInvRow(), ConstantSizeMatrix< FullPrecRealType, std::allocator< FullPrecRealType > >::operator=(), OutputMatrix::output(), LCAOSpinorBuilder::putFromH5(), LCAOrbitalBuilder::putFromH5(), DensityMatrices1B::report(), DensityMatrices1B::same(), qmcplusplus::saveCusp(), Eigensolver::solveGeneralizedEigenvalues(), Eigensolver::solveGeneralizedEigenvalues_Inv(), qmcplusplus::TEMPLATE_TEST_CASE(), TEST_CASE(), qmcplusplus::TEST_CASE(), qmcplusplus::test_DiracDeterminant_delayed_update(), qmcplusplus::test_DiracDeterminant_second(), qmcplusplus::test_DiracDeterminantBatched_delayed_update(), qmcplusplus::test_DiracDeterminantBatched_second(), DelayedUpdate< T, T_FP >::updateInvMat(), DelayedUpdateSYCL< T, T_FP >::updateInvMat(), and DelayedUpdateBatched< PL, VALUE >::updateRow().

78 { return D2; }

◆ copy()

void copy ( const This_t rhs)
inline

Definition at line 143 of file OhmmsMatrix.h.

Referenced by QMCFixedSampleLinearOptimizeBatched::one_shift_run(), QMCFixedSampleLinearOptimizeBatched::previous_linear_methods_run(), QMCFixedSampleLinearOptimize::run(), and QMCFixedSampleLinearOptimizeBatched::solveShiftsWithoutLMYEngine().

144  {
145  resize(rhs.D1, rhs.D2);
146  assign(*this, rhs);
147  }
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99
Matrix< T1, C1 > & assign(Matrix< T1, C1 > &lhs, const RHS &rhs)

◆ data() [1/4]

pointer data ( )
inline

Definition at line 182 of file OhmmsMatrix.h.

Referenced by DelayedUpdate< T, T_FP >::acceptRow(), DelayedUpdateSYCL< T, T_FP >::acceptRow(), DelayedUpdateCUDA< T, T_FP >::acceptRow(), CSEnergyEstimator::accumulate(), MultiQuinticSpline1D< T >::add_spline(), Communicate::allreduce(), MultiQuinticSpline1D< T >::batched_evaluate(), MultiQuinticSpline1D< T >::batched_evaluateVGL(), DiracMatrixComputeOMPTarget< VALUE_FP >::computeInvertAndLog(), qmcplusplus::convertToReal(), LRBreakup< BreakupBasis >::DoAllBreakup(), LRBreakup< BreakupBasis >::DoBreakup(), LRBreakup< BreakupBasis >::DoGradBreakup(), LRBreakup< BreakupBasis >::DoStrainBreakup(), PWOrbitalSet::evaluate_notranspose(), PWRealOrbitalSet::evaluate_notranspose(), PWBasis::evaluateAll(), MultiDiracDeterminant::evaluateDerivatives(), MultiDiracDeterminant::evaluateDerivativesWF(), AGPDeterminant::evaluateLogAndStore(), SOECPComponent::evaluateValueAndDerivatives(), NonLocalECPComponent::evaluateValueAndDerivatives(), PWOrbitalSet::evaluateVGL(), PWRealOrbitalSet::evaluateVGL(), container_traits< Matrix< T, ALLOC > >::getElementPtr(), DelayedUpdate< T, T_FP >::getInvRow(), DelayedUpdateSYCL< T, T_FP >::getInvRow(), DelayedUpdateCUDA< T, T_FP >::getInvRow(), LinearMethod::getLowestEigenvector(), gsum(), DelayedUpdateSYCL< T, T_FP >::initializeInv(), DelayedUpdateCUDA< T, T_FP >::initializeInv(), qmcplusplus::InverseUpdateByColumn(), qmcplusplus::InverseUpdateByRow(), syclSolverInverter< T_FP >::invert_transpose(), cuSolverInverter< T_FP >::invert_transpose(), rocSolverInverter< T_FP >::invert_transpose(), DiracMatrixComputeOMPTarget< VALUE_FP >::invert_transpose(), DiracMatrix< VALUE_FP >::invert_transpose(), DiracMatrixComputeCUDA< VALUE_FP >::invert_transpose(), qmcplusplus::testing::makeRngSpdMatrix(), MultiDiracDeterminant::mw_buildTableMatrix_calculateGradRatios(), DelayedUpdateBatched< PL, VALUE >::mw_evalGradWithSpin(), h5data_proxy< Matrix< T > >::read(), DiracMatrixComputeOMPTarget< VALUE_FP >::reset(), Eigensolver::solveGeneralizedEigenvalues(), Eigensolver::solveGeneralizedEigenvalues_Inv(), qmcplusplus::TEMPLATE_TEST_CASE(), TEST_CASE(), qmcplusplus::TEST_CASE(), qmcplusplus::test_DiracDeterminant_delayed_update(), qmcplusplus::test_DiracDeterminant_second(), qmcplusplus::test_DiracDeterminantBatched_delayed_update(), qmcplusplus::test_DiracDeterminantBatched_second(), qmcplusplus::testDualAllocator(), DelayedUpdate< T, T_FP >::updateInvMat(), DelayedUpdateSYCL< T, T_FP >::updateInvMat(), DelayedUpdateCUDA< T, T_FP >::updateInvMat(), DelayedUpdateBatched< PL, VALUE >::updateRow(), and h5data_proxy< Matrix< T > >::write().

182 { return X.data(); }

◆ data() [2/4]

const_pointer data ( ) const
inline

Definition at line 185 of file OhmmsMatrix.h.

185 { return X.data(); }

◆ data() [3/4]

const Type_t* data ( size_type  i) const
inline

Definition at line 199 of file OhmmsMatrix.h.

199 { return X.data() + i * D2; }

◆ data() [4/4]

Type_t* data ( size_type  i)
inline

returns a pointer of i-th row, g++ iterator problem

Definition at line 202 of file OhmmsMatrix.h.

202 { return X.data() + i * D2; }

◆ device_data() [1/2]

◆ device_data() [2/2]

const_pointer device_data ( ) const
inline

Definition at line 193 of file OhmmsMatrix.h.

194  {
195  return X.device_data();
196  }
pointer device_data()
Return the device_ptr matching X if this is a vector attached or owning dual space memory...
Definition: OhmmsVector.h:245

◆ end() [1/2]

◆ end() [2/2]

Container_t::const_iterator end ( ) const
inline

Definition at line 92 of file OhmmsMatrix.h.

92 { return X.end(); }

◆ extent()

size_type extent ( int  i) const
inline

Definition at line 82 of file OhmmsMatrix.h.

Referenced by MultiDiracDeterminant::buildTableMatrix_calculateRatios_impl().

82 { return (i == 0) ? D1 : D2; }

◆ first_address() [1/2]

pointer first_address ( )
inline

◆ first_address() [2/2]

const_pointer first_address ( ) const
inline

Definition at line 207 of file OhmmsMatrix.h.

207 { return X.data(); }

◆ free()

void free ( )
inline

Definition at line 110 of file OhmmsMatrix.h.

110 { X.free(); }
void free()
free
Definition: OhmmsVector.h:196

◆ getMessage()

Msg& getMessage ( Msg &  m)
inline

Definition at line 363 of file OhmmsMatrix.h.

364  {
365  m.Unpack(X.data(), D1 * D2);
366  return m;
367  }

◆ last_address() [1/2]

pointer last_address ( )
inline

◆ last_address() [2/2]

const Type_t* last_address ( ) const
inline

Definition at line 212 of file OhmmsMatrix.h.

212 { return X.data() + TotSize; }

◆ operator()() [1/4]

Type_t& operator() ( size_type  i)
inline

Definition at line 222 of file OhmmsMatrix.h.

223  {
224  return X[i];
225  }

◆ operator()() [2/4]

Type_t operator() ( size_type  i) const
inline

Definition at line 229 of file OhmmsMatrix.h.

230  {
231  return X[i];
232  }

◆ operator()() [3/4]

Type_t& operator() ( size_type  i,
size_type  j 
)
inline

Definition at line 236 of file OhmmsMatrix.h.

237  {
238  return X[i * D2 + j];
239  }

◆ operator()() [4/4]

const Type_t& operator() ( size_type  i,
size_type  j 
) const
inline

Definition at line 243 of file OhmmsMatrix.h.

244  {
245  return X[i * D2 + j];
246  }

◆ operator=() [1/2]

This_t& operator= ( const This_t rhs)
inline

Definition at line 166 of file OhmmsMatrix.h.

167  {
168  resize(rhs.D1, rhs.D2);
170  assign(*this, rhs);
171  return *this;
172  }
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99
Matrix< T1, C1 > & assign(Matrix< T1, C1 > &lhs, const RHS &rhs)
static constexpr bool is_host_accessible

◆ operator=() [2/2]

This_t& operator= ( const RHS &  rhs)
inline

Definition at line 175 of file OhmmsMatrix.h.

176  {
177  return assign(*this, rhs);
178  }
Matrix< T1, C1 > & assign(Matrix< T1, C1 > &lhs, const RHS &rhs)

◆ operator[]() [1/2]

const Type_t* operator[] ( size_type  i) const
inline

Definition at line 216 of file OhmmsMatrix.h.

216 { return X.data() + i * D2; }

◆ operator[]() [2/2]

Type_t* operator[] ( size_type  i)
inline

returns a pointer of i-th row, g++ iterator problem

Definition at line 219 of file OhmmsMatrix.h.

219 { return X.data() + i * D2; }

◆ putMessage()

Msg& putMessage ( Msg &  m)
inline

Definition at line 356 of file OhmmsMatrix.h.

357  {
358  m.Pack(X.data(), D1 * D2);
359  return m;
360  }

◆ replaceColumn()

void replaceColumn ( IT  first,
size_type  j 
)
inline

Definition at line 277 of file OhmmsMatrix.h.

278  {
279  typename Container_t::iterator ii(X.begin() + j);
280  for (int i = 0; i < D1; i++, ii += D2)
281  *ii = *first++;
282  }

◆ replaceRow()

void replaceRow ( IT  first,
size_type  i 
)
inline

Definition at line 271 of file OhmmsMatrix.h.

272  {
273  std::copy(first, first + D2, X.begin() + i * D2);
274  }
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Definition: Blitz.h:639

◆ resize()

void resize ( size_type  n,
size_type  m 
)
inline

Resize the container.

For performance consideration, previous data may or may not get kept. Please avoid relying on previous data after resizing.

Definition at line 99 of file OhmmsMatrix.h.

Referenced by CSEnergyEstimator::add2Record(), Backflow_ee< FT >::Backflow_ee(), Backflow_ee_kSpace::Backflow_ee_kSpace(), Backflow_eI_spin< FT >::Backflow_eI_spin(), BackflowTransformation::BackflowTransformation(), QMCCostFunctionBatched::checkConfigurations(), Matrix< ST, qmcplusplus::Mallocator< ST > >::copy(), LRBreakup< BreakupBasis >::DoAllBreakup(), LRBreakup< BreakupBasis >::DoBreakup(), LRBreakup< BreakupBasis >::DoGradBreakup(), LRBreakup< BreakupBasis >::DoStrainBreakup(), BackflowTransformation::evaluateDerivatives(), SOECPComponent::evaluateValueAndDerivatives(), NonLocalECPComponent::evaluateValueAndDerivatives(), FakeSPO::FakeSPO(), get_diamond_fill_data(), CountingGaussianRegion::initialize(), CountingJastrow< RegionType >::initialize(), DensityMatrices1B::initialize(), MultiQuinticSpline1D< T >::initialize(), SpaceGrid::initialize_rectilinear(), SpaceGrid::initialize_voronoi(), ForceCeperley::InitMatrix(), ForceChiesaPBCAA::InitMatrix(), DiracMatrix< VALUE_FP >::invert_transpose(), kSpaceJastrow::kSpaceJastrow(), LCAOrbitalBuilder::LoadFullCoefsFromH5(), LPQHIBasis::LPQHIBasis(), LPQHISRCoulombBasis::LPQHISRCoulombBasis(), ForceChiesaPBCAA::makeClone(), qmcplusplus::testing::makeRngSpdMatrix(), Matrix< ST, qmcplusplus::Mallocator< ST > >::Matrix(), MomentumDistribution::MomentumDistribution(), OneBodyDensityMatrices::OneBodyDensityMatrices(), Matrix< ST, qmcplusplus::Mallocator< ST > >::operator=(), EnergyDensityEstimator::put(), SpaceGrid::put(), MomentumEstimator::putSpecial(), h5data_proxy< Matrix< T > >::read(), SpaceGrid::registerCollectables(), BackflowTransformation::registerData(), NESpaceGrid< REAL >::registerGrid(), PWBasis::reset(), MomentumEstimator::resize(), container_traits< Matrix< T, ALLOC > >::resize(), AGPDeterminant::resize(), DelayedUpdate< T, T_FP >::resize(), PWOrbitalSet::resize(), PWRealOrbitalSet::resize(), PolynomialFunctor3D::resize(), DelayedUpdateSYCL< T, T_FP >::resize(), DelayedUpdateCUDA< T, T_FP >::resize(), PairCorrEstimator::resize(), StructFact::resize(), BackflowFunctionBase::resize(), MultiDiracDeterminant::resize(), CSUpdateBase::resizeWorkSpace(), PairCorrEstimator::set_norm_factor(), SoaCuspCorrection::SoaCuspCorrection(), SpaceWarpTransformation::SpaceWarpTransformation(), qmcplusplus::TEMPLATE_TEST_CASE(), qmcplusplus::TEST_CASE(), qmcplusplus::test_DiracDeterminant_delayed_update(), qmcplusplus::test_DiracDeterminant_first(), qmcplusplus::test_DiracDeterminant_second(), qmcplusplus::test_DiracDeterminantBatched_delayed_update(), qmcplusplus::test_DiracDeterminantBatched_first(), qmcplusplus::test_DiracDeterminantBatched_second(), qmcplusplus::test_inverse(), qmcplusplus::test_lcao_spinor(), qmcplusplus::test_lcao_spinor_excited(), BackflowTransformation::testDeriv(), qmcplusplus::testDualAllocator(), DiracDeterminantWithBackflow::testL(), BackflowTransformation::testPbyP(), and PWBasis::trimforecut().

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  }
void resize(size_type n, Type_t val=Type_t())
Resize the container.
Definition: OhmmsVector.h:166

◆ rows()

size_type rows ( ) const
inline

Definition at line 77 of file OhmmsMatrix.h.

Referenced by Backflow_ee< FT >::acceptMove(), Backflow_ee_kSpace::acceptMove(), DelayedUpdate< T, T_FP >::acceptRow(), DelayedUpdateSYCL< T, T_FP >::acceptRow(), DelayedUpdateCUDA< T, T_FP >::acceptRow(), Matrix< ST, qmcplusplus::Mallocator< ST > >::add(), LeafFunctor< Matrix< T, Alloc >, SizeLeaf2 >::apply(), qmcplusplus::applyCuspCorrection(), Matrix< ST, qmcplusplus::Mallocator< ST > >::assignUpperLeft(), qmcplusplus::check_force_copy(), qmcplusplus::check_matrix(), DensityMatrices1B::compare(), LRBreakup< BreakupBasis >::DoAllBreakup(), LRBreakup< BreakupBasis >::DoBreakup(), LRBreakup< BreakupBasis >::DoGradBreakup(), LRBreakup< BreakupBasis >::DoStrainBreakup(), qmcplusplus::evaluate(), MultiDiracDeterminant::evaluateDerivatives(), MultiDiracDeterminant::evaluateDerivativesWF(), qmcplusplus::generateCuspInfo(), EstimatorManagerBase::getData(), DelayedUpdate< T, T_FP >::getInvRow(), DelayedUpdateSYCL< T, T_FP >::getInvRow(), DelayedUpdateCUDA< T, T_FP >::getInvRow(), qmcplusplus::testing::getParticularListener(), qmcplusplus::testing::getSummingListener(), h5data_proxy< Matrix< T > >::h5data_proxy(), qmcplusplus::InverseUpdateByColumn(), syclSolverInverter< T_FP >::invert_transpose(), cuSolverInverter< T_FP >::invert_transpose(), rocSolverInverter< T_FP >::invert_transpose(), DiracMatrixComputeOMPTarget< VALUE_FP >::invert_transpose(), DiracMatrix< VALUE_FP >::invert_transpose(), DiracMatrixComputeCUDA< VALUE_FP >::invert_transpose(), LCAOrbitalBuilder::LoadFullCoefsFromH5(), Backflow_eI_spin< FT >::makeClone(), qmcplusplus::testing::makeRngSpdMatrix(), ConstantSizeMatrix< FullPrecRealType, std::allocator< FullPrecRealType > >::operator=(), OutputMatrix::output(), LCAOSpinorBuilder::putFromH5(), LCAOrbitalBuilder::putFromH5(), qmcplusplus::readCuspInfo(), DensityMatrices1B::report(), DensityMatrices1B::same(), qmcplusplus::saveCusp(), Eigensolver::solveGeneralizedEigenvalues(), Eigensolver::solveGeneralizedEigenvalues_Inv(), qmcplusplus::TEMPLATE_TEST_CASE(), TEST_CASE(), qmcplusplus::TEST_CASE(), qmcplusplus::test_DiracDeterminant_delayed_update(), qmcplusplus::test_DiracDeterminant_second(), qmcplusplus::test_DiracDeterminantBatched_delayed_update(), qmcplusplus::test_DiracDeterminantBatched_second(), DelayedUpdate< T, T_FP >::updateInvMat(), DelayedUpdateSYCL< T, T_FP >::updateInvMat(), DelayedUpdateCUDA< T, T_FP >::updateInvMat(), and DelayedUpdateBatched< PL, VALUE >::updateRow().

77 { return D1; }

◆ size() [1/2]

size_type size ( void  ) const
inline

Definition at line 76 of file OhmmsMatrix.h.

Referenced by Communicate::allreduce(), Backflow_eI_spin< FT >::Backflow_eI_spin(), MultiQuinticSpline1D< T >::batched_evaluate(), MultiQuinticSpline1D< T >::batched_evaluateVGL(), qmcplusplus::check_force_copy(), qmcplusplus::check_matrix(), Backflow_eI_spin< FT >::checkInVariables(), Backflow_eI_spin< FT >::checkOutVariables(), qmcplusplus::convertToReal(), BackflowTransformation::evaluateDerivatives(), SoaCuspCorrection::evaluateV(), DelayedUpdate< T, T_FP >::getInvRow(), DelayedUpdateSYCL< T, T_FP >::getInvRow(), container_traits< Matrix< T, ALLOC > >::getSize(), gsum(), Backflow_eI_spin< FT >::indexOffset(), CountingJastrow< RegionType >::initialize(), MultiQuinticSpline1D< T >::initialize(), DelayedUpdateSYCL< T, T_FP >::initializeInv(), DelayedUpdateCUDA< T, T_FP >::initializeInv(), syclSolverInverter< T_FP >::invert_transpose(), cuSolverInverter< T_FP >::invert_transpose(), rocSolverInverter< T_FP >::invert_transpose(), DiracMatrixComputeCUDA< VALUE_FP >::invert_transpose(), Backflow_eI_spin< FT >::isOptimizable(), qmcplusplus::testing::makeRngSpdMatrix(), ConstantSizeMatrix< FullPrecRealType, std::allocator< FullPrecRealType > >::operator=(), qmcplusplus::operator==(), qmcplusplus::operator>>(), putContent(), Backflow_eI_spin< FT >::reportStatus(), Backflow_eI_spin< FT >::resetParameters(), qmcplusplus::TEST_CASE(), BackflowTransformation::testDeriv(), Matrix< ST, qmcplusplus::Mallocator< ST > >::updateFrom(), DelayedUpdateSYCL< T, T_FP >::updateInvMat(), DelayedUpdateCUDA< T, T_FP >::updateInvMat(), Matrix< ST, qmcplusplus::Mallocator< ST > >::updateTo(), and Backflow_eI_spin< FT >::~Backflow_eI_spin().

76 { return TotSize; }

◆ size() [2/2]

size_type size ( int  i) const
inline

Definition at line 81 of file OhmmsMatrix.h.

81 { return (i == 0) ? D1 : D2; }

◆ size1()

size_type size1 ( ) const
inline

◆ size2()

size_type size2 ( ) const
inline

Definition at line 80 of file OhmmsMatrix.h.

Referenced by NESpaceGrid< REAL >::accumulate(), and SpaceGrid::evaluate().

80 { return D2; }

◆ swap_cols()

void swap_cols ( int  c1,
int  c2 
)
inline

Definition at line 260 of file OhmmsMatrix.h.

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  }

◆ swap_rows()

void swap_rows ( int  r1,
int  r2 
)
inline

Definition at line 249 of file OhmmsMatrix.h.

Referenced by PolynomialFunctor3D::resize().

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  }

◆ updateFrom()

void updateFrom ( size_type  size = 0,
std::ptrdiff_t  offset = 0 
)
inline

Definition at line 376 of file OhmmsMatrix.h.

377  {
378  X.updateFrom(size, offset);
379  }
void updateFrom(size_type size=0, std::ptrdiff_t offset=0)
Definition: OhmmsVector.h:272
size_type size() const
Definition: OhmmsMatrix.h:76

◆ updateTo()

void updateTo ( size_type  size = 0,
std::ptrdiff_t  offset = 0 
)
inline

Definition at line 371 of file OhmmsMatrix.h.

Referenced by MultiQuinticSpline1D< T >::finalize(), DiracDeterminantBatched< PL, VT, FPVT >::invertPsiM(), and SpinorSet::mw_evaluateVGLWithSpin().

372  {
373  X.updateTo(size, offset);
374  }
size_type size() const
Definition: OhmmsMatrix.h:76
void updateTo(size_type size=0, std::ptrdiff_t offset=0)
Definition: OhmmsVector.h:263

Member Data Documentation

◆ D1

◆ D2

◆ TotSize

◆ X


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