Skip to content
Snippets Groups Projects
Commit 331345d0 authored by Gauthier Becker's avatar Gauthier Becker
Browse files

Rewrite for more efficiency

parent f8525ea6
No related branches found
No related tags found
No related merge requests found
......@@ -16,9 +16,9 @@ class SPoint3 {
SPoint3(double x, double y, double z) { P[0] = x; P[1] = y; P[2] = z; }
SPoint3(const double *p) { P[0] = p[0]; P[1] = p[1]; P[2] = p[2]; }
SPoint3(const SPoint3 &pt) { P[0] = pt.P[0]; P[1] = pt.P[1]; P[2] = pt.P[2]; }
SPoint3(const SPoint3 &pt,const SPoint3 &dir,const double dist_) {P[0]=pt.P[0]; P[1]=pt.P[1]; P[2]=pt.P[2]; SPoint3 a(dir); a*=dist_; P[0]+=a[0]; P[1]+=a[1]; P[2]+=a[2];}
virtual ~SPoint3() {}
void setPosition(double xx, double yy, double zz);
void setPosition(const SPoint3 &pt,const SPoint3 &dir,const double dist_) {P[0]=pt.P[0]; P[1]=pt.P[1]; P[2]=pt.P[2]; SPoint3 a(dir); a*=dist_; P[0]+=a[0]; P[1]+=a[1]; P[2]+=a[2];}
void getPosition(double *xx, double *yy, double *zz) const;
void position(double *) const;
inline double x(void) const;
......
......@@ -127,6 +127,15 @@ void fullMatrix<double>::mult(const fullVector<double> &x, fullVector<double> &y
&beta, y._data, &INCY);
}
template<>
void fullMatrix<double>::multAddy(const fullVector<double> &x, fullVector<double> &y) const
{
int M = _r, N = _c, LDA = _r, INCX = 1, INCY = 1;
double alpha = 1., beta = 1.;
F77NAME(dgemv)("N", &M, &N, &alpha, _data, &LDA, x._data, &INCX,
&beta, y._data, &INCY);
}
template<>
void fullMatrix<std::complex<double> >::mult(const fullVector<std::complex<double> > &x,
fullVector<std::complex<double> > &y) const
......@@ -137,6 +146,16 @@ void fullMatrix<std::complex<double> >::mult(const fullVector<std::complex<doubl
&beta, y._data, &INCY);
}
template<>
void fullMatrix<std::complex<double> >::multAddy(const fullVector<std::complex<double> > &x,
fullVector<std::complex<double> > &y) const
{
int M = _r, N = _c, LDA = _r, INCX = 1, INCY = 1;
std::complex<double> alpha = 1., beta = 1.;
F77NAME(zgemv)("N", &M, &N, &alpha, _data, &LDA, x._data, &INCX,
&beta, y._data, &INCY);
}
#endif
......
......@@ -409,6 +409,15 @@ class fullMatrix
for(int j = 0; j < _c; j++)
y._data[i] += (*this)(i, j) * x(j);
}
#endif
;
void multAddy(const fullVector<scalar> &x, fullVector<scalar> &y) const
#if !defined(HAVE_BLAS)
{
for(int i = 0; i < _r; i++)
for(int j = 0; j < _c; j++)
y._data[i] += (*this)(i, j) * x(j);
}
#endif
;
inline fullMatrix<scalar> transpose()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment