semisparsemat ostream output
This commit is contained in:
11
sparsemat.h
11
sparsemat.h
@@ -326,10 +326,9 @@ return *this;
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
class SemiSparseMat {
|
class SemiSparseMat {
|
||||||
friend class NRMat<T>;
|
friend class NRMat<T>;
|
||||||
protected:
|
public:
|
||||||
NRVec<T> diagonal;
|
NRVec<T> diagonal;
|
||||||
SparseMat<T> offdiagonal;
|
SparseMat<T> offdiagonal;
|
||||||
public:
|
|
||||||
SemiSparseMat() {};
|
SemiSparseMat() {};
|
||||||
SemiSparseMat(const SPMatindex n, const SPMatindex m) : offdiagonal(n,m) {if(n==m) diagonal.resize(n);};
|
SemiSparseMat(const SPMatindex n, const SPMatindex m) : offdiagonal(n,m) {if(n==m) diagonal.resize(n);};
|
||||||
SPMatindex nrows() const {return offdiagonal.nrows();}
|
SPMatindex nrows() const {return offdiagonal.nrows();}
|
||||||
@@ -361,6 +360,14 @@ public:
|
|||||||
void resize(const SPMatindex n, const SPMatindex m) {offdiagonal.resize(n,m); diagonal.resize(n==m?n:0);}
|
void resize(const SPMatindex n, const SPMatindex m) {offdiagonal.resize(n,m); diagonal.resize(n==m?n:0);}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
std::ostream& operator<<(std::ostream &s, const SemiSparseMat<T> &x)
|
||||||
|
{
|
||||||
|
s << "diagonal= "<<x.diagonal;
|
||||||
|
s << "offdiagonal= "<<x.offdiagonal;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}//namespace
|
}//namespace
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user