46 #ifndef _PEXSI_NUMVEC_HPP_
47 #define _PEXSI_NUMVEC_HPP_
84 NumVec(Int m,
bool owndata, F* data);
90 void Resize ( Int m );
93 const F& operator()(Int i)
const;
95 const F& operator[](Int i)
const;
98 bool IsOwnData()
const {
return owndata_; }
99 F* Data()
const {
return data_; }
100 Int m ()
const {
return m_; }
101 Int ByteSize()
const {
return m_*
sizeof(F);}
105 typedef NumVec<bool> BolNumVec;
106 typedef NumVec<Int> IntNumVec;
107 typedef NumVec<Real> DblNumVec;
108 typedef NumVec<Complex> CpxNumVec;
115 template <
class F>
inline void SetValue( NumVec<F>& vec, F val );
118 template <
class F>
inline Real
Energy(
const NumVec<F>& vec );
125 #endif // _PEXSI_NUMVEC_HPP_
Numerical vector.
Definition: NumVec.hpp:60
void allocate(F *data=NULL)
Helper function allocating the memory pointed by the data_ attribute.
Definition: NumVec_impl.hpp:171
void deallocate()
Helper function freeing memory pointed by the data_ attribute.
Definition: NumVec_impl.hpp:192
Real Energy(const NumMat< F > &M)
Energy computes the L2 norm of a matrix (treated as a vector).
Definition: NumMat_impl.hpp:158
bool owndata_
Whether it owns the data.
Definition: NumVec.hpp:74
void SetValue(NumMat< F > &M, F val)
SetValue sets a numerical matrix to a constant val.
Definition: NumMat_impl.hpp:153
Implementation of Numerical Vector.
F * data_
The pointer for the actual data.
Definition: NumVec.hpp:77
Int bufsize_
The actual storage space allocated.
Definition: NumVec.hpp:80
Int m_
The size of the vector.
Definition: NumVec.hpp:71