From 49dd96eab295de61e80d643a49f7ec87dd488d11 Mon Sep 17 00:00:00 2001 From: jiri Date: Tue, 31 Jul 2012 09:18:18 +0000 Subject: [PATCH] *** empty log message *** --- sparsemat.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sparsemat.cc b/sparsemat.cc index cf5651f..41758e3 100644 --- a/sparsemat.cc +++ b/sparsemat.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include "bitvector.h" #include "sparsemat.h" @@ -40,10 +41,6 @@ static inline void SWAP(T &a, T &b) -extern "C" { -extern ssize_t read(int, void *, size_t); -extern ssize_t write(int, const void *, size_t); -} template @@ -146,7 +143,7 @@ while(l) } template -void SparseMat::copyonwrite() +void SparseMat::copyonwrite(bool detachonly) { if(!count) laerror("probably an assignment to undefined sparse matrix"); if(*count > 1) @@ -155,7 +152,7 @@ void SparseMat::copyonwrite() count = new int; *count=1; if(!list) laerror("empty list with count>1"); unsort(); - copylist(list); + if(!detachonly) copylist(list); } } @@ -1302,4 +1299,13 @@ INSTANTIZE(complex) //some functions are not OK for hermitean matrices, template class SparseMat; template class SparseMat >; +#define INSTANTIZE(T) \ +template NRMat::NRMat(const SparseMat &rhs); \ +template NRSMat::NRSMat(const SparseMat &rhs); \ +template NRVec::NRVec(const SparseMat &rhs); + +INSTANTIZE(double) +INSTANTIZE(complex) + + }//namespace