*** empty log message ***

This commit is contained in:
jiri 2006-04-09 21:07:54 +00:00
parent 073f9c09d1
commit 3a243630de
6 changed files with 34 additions and 4 deletions

View File

@ -127,6 +127,7 @@ static inline void put(int fd, const complex<C> &x, bool dimensions=0, bool tran
static void multiget(unsigned int n,int fd, complex<C> *x, bool dimensions=0){if((ssize_t)(n*sizeof(complex<C>))!=read(fd,x,n*sizeof(complex<C>))) laerror("read error");} static void multiget(unsigned int n,int fd, complex<C> *x, bool dimensions=0){if((ssize_t)(n*sizeof(complex<C>))!=read(fd,x,n*sizeof(complex<C>))) laerror("read error");}
static void multiput(unsigned int n, int fd, const complex<C> *x, bool dimensions=0) {if((ssize_t)(n*sizeof(complex<C>))!=write(fd,x,n*sizeof(complex<C>))) laerror("write error");} static void multiput(unsigned int n, int fd, const complex<C> *x, bool dimensions=0) {if((ssize_t)(n*sizeof(complex<C>))!=write(fd,x,n*sizeof(complex<C>))) laerror("write error");}
static void copy(complex<C> *dest, complex<C> *src, unsigned int n) {memcpy(dest,src,n*sizeof(complex<C>));} static void copy(complex<C> *dest, complex<C> *src, unsigned int n) {memcpy(dest,src,n*sizeof(complex<C>));}
static void clear(complex<C> *dest, unsigned int n) {memset(dest,0,n*sizeof(complex<C>));}
}; };
//non-complex scalars //non-complex scalars
@ -145,6 +146,7 @@ static inline void get(int fd, C &x, bool dimensions=0, bool transp=0) {if(sizeo
static void multiput(unsigned int n,int fd, const C *x, bool dimensions=0){if((ssize_t)(n*sizeof(C))!=write(fd,x,n*sizeof(C))) laerror("write error");} static void multiput(unsigned int n,int fd, const C *x, bool dimensions=0){if((ssize_t)(n*sizeof(C))!=write(fd,x,n*sizeof(C))) laerror("write error");}
static void multiget(unsigned int n, int fd, C *x, bool dimensions=0) {if((ssize_t)(n*sizeof(C))!=read(fd,x,n*sizeof(C))) laerror("read error");} static void multiget(unsigned int n, int fd, C *x, bool dimensions=0) {if((ssize_t)(n*sizeof(C))!=read(fd,x,n*sizeof(C))) laerror("read error");}
static void copy(C *dest, C *src, unsigned int n) {memcpy(dest,src,n*sizeof(C));} static void copy(C *dest, C *src, unsigned int n) {memcpy(dest,src,n*sizeof(C));}
static void clear(C *dest, unsigned int n) {memset(dest,0,n*sizeof(C));}
}; };
@ -169,6 +171,7 @@ static void get(int fd, C &x, bool dimensions=1, bool transp=0) {x.get(fd,dimens
static void multiput(unsigned int n,int fd, const C *x, bool dimensions=1) {for(unsigned int i=0; i<n; ++i) x[i].put(fd,dimensions);} \ static void multiput(unsigned int n,int fd, const C *x, bool dimensions=1) {for(unsigned int i=0; i<n; ++i) x[i].put(fd,dimensions);} \
static void multiget(unsigned int n,int fd, C *x, bool dimensions=1) {for(unsigned int i=0; i<n; ++i) x[i].get(fd,dimensions);} \ static void multiget(unsigned int n,int fd, C *x, bool dimensions=1) {for(unsigned int i=0; i<n; ++i) x[i].get(fd,dimensions);} \
static void copy(C *dest, C *src, unsigned int n) {for(unsigned int i=0; i<n; ++i) dest[i]=src[i];} \ static void copy(C *dest, C *src, unsigned int n) {for(unsigned int i=0; i<n; ++i) dest[i]=src[i];} \
static void clear(C *dest, unsigned int n) {for(unsigned int i=0; i<n; ++i) dest[i]=C(0);}\
}; };
@ -192,9 +195,10 @@ static inline normtype norm (const NRSMat<C> &x) {return x.norm();}
static inline void axpy (NRSMat<C>&s, const NRSMat<C> &x, const C c) {s.axpy(c,x);} static inline void axpy (NRSMat<C>&s, const NRSMat<C> &x, const C c) {s.axpy(c,x);}
static void put(int fd, const C &x, bool dimensions=1, bool transp=0) {x.put(fd,dimensions);} static void put(int fd, const C &x, bool dimensions=1, bool transp=0) {x.put(fd,dimensions);}
static void get(int fd, C &x, bool dimensions=1, bool transp=0) {x.get(fd,dimensions);} static void get(int fd, C &x, bool dimensions=1, bool transp=0) {x.get(fd,dimensions);}
static void multiput(unsigned int n,int fd, const C *x, bool dimensions=1) {for(unsigned int i=0; i<n; ++i) x[i].put(fd,dimensions);} \ static void multiput(unsigned int n,int fd, const C *x, bool dimensions=1) {for(unsigned int i=0; i<n; ++i) x[i].put(fd,dimensions);}
static void multiget(unsigned int n,int fd, C *x, bool dimensions=1) {for(unsigned int i=0; i<n; ++i) x[i].get(fd,dimensions);} \ static void multiget(unsigned int n,int fd, C *x, bool dimensions=1) {for(unsigned int i=0; i<n; ++i) x[i].get(fd,dimensions);}
static void copy(C *dest, C *src, unsigned int n) {for(unsigned int i=0; i<n; ++i) dest[i]=src[i];} \ static void copy(C *dest, C *src, unsigned int n) {for(unsigned int i=0; i<n; ++i) dest[i]=src[i];}
static void clear(C *dest, unsigned int n) {for(unsigned int i=0; i<n; ++i) dest[i]=C(0);}
}; };

View File

@ -3,6 +3,11 @@
#include "laerror.h" #include "laerror.h"
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#ifdef USE_TRACEBACK
#include "traceback.h"
#endif
void laerror(const char *s1) void laerror(const char *s1)
{ {
std::cerr << "LA:ERROR - "; std::cerr << "LA:ERROR - ";
@ -13,8 +18,13 @@ void laerror(const char *s1)
std::cout << s1 << "\n"; std::cout << s1 << "\n";
} }
if(errno) perror("system error"); if(errno) perror("system error");
throw LAerror(s1);
#ifdef USE_TRACEBACK
traceback(1);
exit(1); exit(1);
#else
throw LAerror(s1); //traceback possible via sigtraceback, but BFD library might fail for -O3 code on some machines and source lines would not be available
#endif
} }
//stub for f77 blas called from strassen routine //stub for f77 blas called from strassen routine

1
mat.h
View File

@ -38,6 +38,7 @@ public:
const bool operator==(const NRMat &rhs) const {return !(*this != rhs);}; const bool operator==(const NRMat &rhs) const {return !(*this != rhs);};
inline int getcount() const {return count?*count:0;} inline int getcount() const {return count?*count:0;}
NRMat & operator=(const NRMat &rhs); //assignment NRMat & operator=(const NRMat &rhs); //assignment
void clear() {LA_traits<T>::clear((*this)[0],nn*mm);}; //zero out
NRMat & operator=(const T &a); //assign a to diagonal NRMat & operator=(const T &a); //assign a to diagonal
NRMat & operator|=(const NRMat &rhs); //assignment to a new copy NRMat & operator|=(const NRMat &rhs); //assignment to a new copy
NRMat & operator+=(const T &a); //add diagonal NRMat & operator+=(const T &a); //add diagonal

1
smat.h
View File

@ -23,6 +23,7 @@ public:
explicit NRSMat(const NRVec<T> &rhs, const int n); //construct matrix from vector explicit NRSMat(const NRVec<T> &rhs, const int n); //construct matrix from vector
NRSMat & operator|=(const NRSMat &rhs); //assignment to a new copy NRSMat & operator|=(const NRSMat &rhs); //assignment to a new copy
NRSMat & operator=(const NRSMat &rhs); //assignment NRSMat & operator=(const NRSMat &rhs); //assignment
void clear() {LA_traits<T>::clear(v,NN2);}; //zero out
NRSMat & operator=(const T &a); //assign a to diagonal NRSMat & operator=(const T &a); //assign a to diagonal
const bool operator!=(const NRSMat &rhs) const {if(nn!=rhs.nn) return 1; return LA_traits<T>::gencmp(v,rhs.v,NN2);} //memcmp for scalars else elementwise const bool operator!=(const NRSMat &rhs) const {if(nn!=rhs.nn) return 1; return LA_traits<T>::gencmp(v,rhs.v,NN2);} //memcmp for scalars else elementwise
const bool operator==(const NRSMat &rhs) const {return !(*this != rhs);}; const bool operator==(const NRSMat &rhs) const {return !(*this != rhs);};

13
test.cc
View File

@ -2,10 +2,21 @@
#include "qsort.h" #include "qsort.h"
#include "la.h" #include "la.h"
#include "fourindex.h" #include "fourindex.h"
#include "laerror.h"
#include "traceback.h"
void test2(char *msg)
{
laerror(msg);
}
int main(void) int main(void)
{ {
sigtraceback(SIGSEGV,1);
sigtraceback(SIGABRT,1);
sigtraceback(SIGBUS,1);
sigtraceback(SIGFPE,1);
bitvector v(100); bitvector v(100);
v.fill(); v.fill();
bitvector x(50); x=v; bitvector x(50); x=v;
@ -37,6 +48,8 @@ cout<<t;
NRSMat_from1<double> a(5),b(5),c; NRSMat_from1<double> a(5),b(5),c;
c=a+b; c=a+b;
test2("pokus");
fourindex<int,double> f; fourindex<int,double> f;
fourindex_dense<twoelectronrealmullikan,double,int> ff(f); fourindex_dense<twoelectronrealmullikan,double,int> ff(f);
} }

1
vec.h
View File

@ -52,6 +52,7 @@ public:
#endif #endif
NRVec & operator=(const NRVec &rhs); NRVec & operator=(const NRVec &rhs);
NRVec & operator=(const T &a); //assign a to every element NRVec & operator=(const T &a); //assign a to every element
void clear() {LA_traits<T>::clear(v,nn);}; //zero out
NRVec & operator|=(const NRVec &rhs); NRVec & operator|=(const NRVec &rhs);
const bool operator!=(const NRVec &rhs) const {if(nn!=rhs.nn) return 1; return LA_traits<T>::gencmp(v,rhs.v,nn);} //memcmp for scalars else elementwise const bool operator!=(const NRVec &rhs) const {if(nn!=rhs.nn) return 1; return LA_traits<T>::gencmp(v,rhs.v,nn);} //memcmp for scalars else elementwise
const bool operator==(const NRVec &rhs) const {return !(*this != rhs);}; const bool operator==(const NRVec &rhs) const {return !(*this != rhs);};