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);
93 const F& operator()(Int i, Int j)
const;
94 F& operator()(Int i, Int j);
95 F* Data()
const {
return data_; }
96 F* VecData(Int j)
const;
97 Int m()
const {
return m_; }
98 Int n()
const {
return n_; }
99 Int Size()
const {
return m_*
n_;}
100 Int ByteSize()
const {
return m_*
n_*
sizeof(F);}
101 Int AllocatedSize()
const {
return bufsize_;}
105 typedef NumMat<bool> BolNumMat;
106 typedef NumMat<Int> IntNumMat;
107 typedef NumMat<Real> DblNumMat;
108 typedef NumMat<Complex> CpxNumMat;
114 template <
class F>
inline void SetValue(NumMat<F>& M, F val);
117 template <
class F>
inline Real
Energy(
const NumMat<F>& M);
125 #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:142
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:61
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:137
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