*** empty log message ***
This commit is contained in:
53
la_traits.h
53
la_traits.h
@@ -220,8 +220,30 @@ static inline normtype norm (const complex<C> &x) {return std::abs(x);}
|
||||
static inline void axpy (complex<C> &s, const complex<C> &x, const complex<C> &c) {s+=x*c;}
|
||||
static inline void get(int fd, complex<C> &x, bool dimensions=0, bool transp=0) {if(sizeof(complex<C>)!=read(fd,&x,sizeof(complex<C>))) laerror("read error");}
|
||||
static inline void put(int fd, const complex<C> &x, bool dimensions=0, bool transp=0) {if(sizeof(complex<C>)!=write(fd,&x,sizeof(complex<C>))) laerror("write error");}
|
||||
static void multiget(size_t n,int fd, complex<C> *x, bool dimensions=0){ssize_t r=read(fd,x,n*sizeof(complex<C>)); if((ssize_t)(n*sizeof(complex<C>))!=r) {std::cout<<"read returned "<<r<<std::endl; laerror("read error");}}
|
||||
static void multiput(size_t n, int fd, const complex<C> *x, bool dimensions=0) {ssize_t r=write(fd,x,n*sizeof(complex<C>)); if((ssize_t)(n*sizeof(complex<C>))!=r) {std::cout<<"write returned "<<r<<std::endl; laerror("write error");}}
|
||||
static void multiget(size_t n,int fd, complex<C> *x, bool dimensions=0)
|
||||
{
|
||||
size_t total=0;
|
||||
ssize_t r;
|
||||
do{
|
||||
r=read(fd,x+total,(n-total)*sizeof(complex<C>));
|
||||
if(r<0 || r==0 && n!=0 ) {std::cout<<"read returned "<<r<<std::endl; laerror("read error");}
|
||||
else total += r/sizeof(complex<C>);
|
||||
if(r%sizeof(complex<C>)) laerror("read error 2");
|
||||
}
|
||||
while(total < n);
|
||||
}
|
||||
static void multiput(size_t n, int fd, const complex<C> *x, bool dimensions=0)
|
||||
{
|
||||
size_t total=0;
|
||||
ssize_t r;
|
||||
do{
|
||||
r=write(fd,x+total,(n-total)*sizeof(complex<C>));
|
||||
if(r<0 || r==0 && n!=0 ) {std::cout<<"write returned "<<r<<std::endl; laerror("write error");}
|
||||
else total += r/sizeof(complex<C>);
|
||||
if(r%sizeof(complex<C>)) laerror("write error 2");
|
||||
}
|
||||
while(total < n);
|
||||
}
|
||||
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>));}
|
||||
static void copyonwrite(complex<C> &x) {};
|
||||
@@ -232,6 +254,7 @@ static inline C realpart(const complex<C> &x) {return x.real();}
|
||||
static inline C imagpart(const complex<C> &x) {return x.imag();}
|
||||
};
|
||||
|
||||
|
||||
//non-complex scalars
|
||||
template<typename C>
|
||||
struct LA_traits_aux<C, scalar_true> {
|
||||
@@ -248,8 +271,30 @@ static inline normtype norm (const C &x) {return std::abs(x);}
|
||||
static inline void axpy (C &s, const C &x, const C &c) {s+=x*c;}
|
||||
static inline void put(int fd, const C &x, bool dimensions=0, bool transp=0) {if(sizeof(C)!=write(fd,&x,sizeof(C))) laerror("write error");}
|
||||
static inline void get(int fd, C &x, bool dimensions=0, bool transp=0) {if(sizeof(C)!=read(fd,&x,sizeof(C))) laerror("read error");}
|
||||
static void multiget(size_t n,int fd, C *x, bool dimensions=0){ssize_t r=read(fd,x,n*sizeof(C)); if((ssize_t)(n*sizeof(C))!=r) {std::cout<<"read returned "<<r<<std::endl; laerror("read error");}}
|
||||
static void multiput(size_t n, int fd, const C *x, bool dimensions=0) {ssize_t r=write(fd,x,n*sizeof(C)); if((ssize_t)(n*sizeof(C))!=r) {std::cout<<"write returned "<<r<<std::endl; laerror("write error");}}
|
||||
static void multiget(size_t n,int fd, C *x, bool dimensions=0)
|
||||
{
|
||||
size_t total=0;
|
||||
ssize_t r;
|
||||
do{
|
||||
r=read(fd,x+total,(n-total)*sizeof(C));
|
||||
if(r<0 || r==0 && n!=0 ) {std::cout<<"read returned "<<r<<std::endl; laerror("read error");}
|
||||
else total += r/sizeof(C);
|
||||
if(r%sizeof(C)) laerror("read error 2");
|
||||
}
|
||||
while(total < n);
|
||||
}
|
||||
static void multiput(size_t n, int fd, const C *x, bool dimensions=0)
|
||||
{
|
||||
size_t total=0;
|
||||
ssize_t r;
|
||||
do{
|
||||
r=write(fd,x+total,(n-total)*sizeof(C));
|
||||
if(r<0 || r==0 && n!=0 ) {std::cout<<"write returned "<<r<<std::endl; laerror("write error");}
|
||||
else total += r/sizeof(C);
|
||||
if(r%sizeof(C)) laerror("write error 2");
|
||||
}
|
||||
while(total < n);
|
||||
}
|
||||
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));}
|
||||
static void copyonwrite(C &x) {};
|
||||
|
||||
Reference in New Issue
Block a user