*** empty log message ***

This commit is contained in:
jiri 2006-09-13 21:29:28 +00:00
parent 1e83e35cb1
commit 30b5975c15
4 changed files with 10 additions and 7 deletions

9
mat.cc
View File

@ -18,19 +18,20 @@ extern ssize_t write(int, const void *, size_t);
//row of //row of
template <typename T> template <typename T>
const NRVec<T> NRMat<T>::row(const int i) const const NRVec<T> NRMat<T>::row(const int i, int l) const
{ {
#ifdef DEBUG #ifdef DEBUG
if(i<0||i>=nn) laerror("illegal index in row()"); if(i<0||i>=nn) laerror("illegal index in row()");
#endif #endif
NRVec<T> r(mm); if(l < 0) l=mm;
NRVec<T> r(l);
LA_traits<T>::copy(&r[0], LA_traits<T>::copy(&r[0],
#ifdef MATPTR #ifdef MATPTR
v[i] v[i]
#else #else
v+i*mm v+i*l
#endif #endif
,mm); ,l);
return r; return r;
} }

4
mat.h
View File

@ -70,8 +70,8 @@ public:
const NRVec<T> operator*(const NRVec<T> &rhs) const {NRVec<T> result(nn); result.gemv((T)0,*this,'n',(T)1,rhs); return result;}; // Mat * Vec const NRVec<T> operator*(const NRVec<T> &rhs) const {NRVec<T> result(nn); result.gemv((T)0,*this,'n',(T)1,rhs); return result;}; // Mat * Vec
const NRVec<T> rsum() const; //sum of rows const NRVec<T> rsum() const; //sum of rows
const NRVec<T> csum() const; //sum of columns const NRVec<T> csum() const; //sum of columns
const NRVec<T> row(const int i) const; //row of, efficient const NRVec<T> row(const int i, int l= -1) const; //row of, efficient
const NRVec<T> column(const int j) const {NRVec<T> r(nn); for(int i=0; i<nn; ++i) r[i]= (*this)(i,j); return r;}; //column of, general but not very efficient const NRVec<T> column(const int j, int l= -1) const {if(l<0) l=nn; NRVec<T> r(l); for(int i=0; i<l; ++i) r[i]= (*this)(i,j); return r;}; //column of, general but not very efficient
const T* diagonalof(NRVec<T> &, const bool divide=0, bool cache=false) const; //get diagonal const T* diagonalof(NRVec<T> &, const bool divide=0, bool cache=false) const; //get diagonal
void gemv(const T beta, NRVec<T> &r, const char trans, const T alpha, const NRVec<T> &x) const {r.gemv(beta,*this,trans,alpha,x);}; void gemv(const T beta, NRVec<T> &r, const char trans, const T alpha, const NRVec<T> &x) const {r.gemv(beta,*this,trans,alpha,x);};
inline T* operator[](const int i); //subscripting: pointer to row i inline T* operator[](const int i); //subscripting: pointer to row i

View File

@ -258,7 +258,6 @@ if(mat.nrows()!=mat.ncols()||(unsigned int) mat.nrows() != (unsigned int)rhs.siz
int power; int power;
//prepare the polynom of and effectively scale the matrix //prepare the polynom of and effectively scale the matrix
NRVec<typename LA_traits<V>::elementtype> taylor2=exp_aux<M,typename LA_traits<V>::elementtype>(mat,power,maxpower,maxtaylor); NRVec<typename LA_traits<V>::elementtype> taylor2=exp_aux<M,typename LA_traits<V>::elementtype>(mat,power,maxpower,maxtaylor);
cerr <<"test power "<<power<<endl;
V tmp; V tmp;

3
vec.cc
View File

@ -274,6 +274,8 @@ NRVec< complex<double> > & NRVec< complex<double> >::normalize()
//stubs for linkage //stubs for linkage
template<> template<>
NRVec<unsigned char> & NRVec<unsigned char>::normalize() {laerror("normalize() impossible for integer types"); return *this;}
template<>
NRVec<int> & NRVec<int>::normalize() {laerror("normalize() impossible for integer types"); return *this;} NRVec<int> & NRVec<int>::normalize() {laerror("normalize() impossible for integer types"); return *this;}
template<> template<>
NRVec<short> & NRVec<short>::normalize() {laerror("normalize() impossible for integer types"); return *this;} NRVec<short> & NRVec<short>::normalize() {laerror("normalize() impossible for integer types"); return *this;}
@ -535,6 +537,7 @@ else return memqsort<0,NRVec<T>,int,int>(*this,perm,from,to);
template class NRVec<double>; template class NRVec<double>;
template class NRVec<complex<double> >; template class NRVec<complex<double> >;
template class NRVec<char>; template class NRVec<char>;
template class NRVec<unsigned char>;
template class NRVec<short>; template class NRVec<short>;
template class NRVec<int>; template class NRVec<int>;
template class NRVec<unsigned int>; template class NRVec<unsigned int>;