46 #ifndef _PEXSI_NUMMAT_HPP_
47 #define _PEXSI_NUMMAT_HPP_
87 NumMat(Int m, Int n,
bool owndata, F* data);
92 void Resize(Int m, Int n);
94 const F& operator()(Int i, Int j)
const;
95 F& operator()(Int i, Int j);
96 F* Data()
const {
return data_; }
97 F* VecData(Int j)
const;
98 Int m()
const {
return m_; }
99 Int n()
const {
return n_; }
100 Int Size()
const {
return m_*
n_;}
101 Int ByteSize()
const {
return m_*
n_*
sizeof(F);}
102 Int AllocatedSize()
const {
return bufsize_;}
106 typedef NumMat<bool> BolNumMat;
107 typedef NumMat<Int> IntNumMat;
108 typedef NumMat<Real> DblNumMat;
109 typedef NumMat<Complex> CpxNumMat;
115 template <
class F>
inline void SetValue(NumMat<F>& M, F val);
118 template <
class F>
inline Real
Energy(
const NumMat<F>& M);
126 #endif // _PEXSI_NUMMAT_HPP_
Int bufsize_
Actual size of the allocated buffer. Similar to the capacity of a std::vector.
Definition: NumMat.hpp:77
Real Energy(const NumMat< F > &M)
Energy computes the L2 norm of a matrix (treated as a vector).
Definition: NumMat_impl.hpp:176
F * data_
The pointer for the actual data.
Definition: NumMat.hpp:74
void deallocate()
Helper function freeing memory pointed by the data_ attribute.
Definition: NumMat_impl.hpp:66
void allocate(F *data=NULL)
Helper function allocating the memory pointed by the data_ attribute.
Definition: NumMat_impl.hpp:52
void SetValue(NumMat< F > &M, F val)
SetValue sets a numerical matrix to a constant val.
Definition: NumMat_impl.hpp:171
Implementation of numerical matrix.
bool owndata_
Whether it owns the data.
Definition: NumMat.hpp:65
Numerical matrix.
Definition: NumMat.hpp:61
Int m_
The size of the first dimension.
Definition: NumMat.hpp:68
Int n_
The size of second dimension.
Definition: NumMat.hpp:71