Skip to content
Snippets Groups Projects
Commit 324157bb authored by Éric Béchet's avatar Éric Béchet
Browse files

No commit message

No commit message
parent 637a4223
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ class fullVector ...@@ -29,7 +29,7 @@ class fullVector
fullVector(int r) : _r(r),_own_data(1) fullVector(int r) : _r(r),_own_data(1)
{ {
_data = new scalar[_r]; _data = new scalar[_r];
setAll(0.); setAll(scalar(0.));
} }
fullVector(const fullVector<scalar> &other) : _r(other._r),_own_data(1) fullVector(const fullVector<scalar> &other) : _r(other._r),_own_data(1)
{ {
...@@ -84,12 +84,12 @@ class fullVector ...@@ -84,12 +84,12 @@ class fullVector
_data = new scalar[_r]; _data = new scalar[_r];
_own_data = true; _own_data = true;
if(resetValue) if(resetValue)
setAll(scalar()); setAll(scalar(0.));
return true; return true;
} }
_r = r; _r = r;
if(resetValue) if(resetValue)
setAll(scalar()); setAll(scalar(0.));
return false; return false;
} }
void setAsProxy(const fullVector<scalar> &original, int r_start, int r) void setAsProxy(const fullVector<scalar> &original, int r_start, int r)
...@@ -108,8 +108,8 @@ class fullVector ...@@ -108,8 +108,8 @@ class fullVector
} }
inline void scale(const scalar s) inline void scale(const scalar s)
{ {
if(s == 0.) if(s == scalar(0.))
for(int i = 0; i < _r; ++i) _data[i] = 0.; for(int i = 0; i < _r; ++i) _data[i] = scalar(0.);
else if (s == -1.) else if (s == -1.)
for(int i = 0; i < _r; ++i) _data[i] = -_data[i]; for(int i = 0; i < _r; ++i) _data[i] = -_data[i];
else else
...@@ -191,12 +191,12 @@ class fullMatrix ...@@ -191,12 +191,12 @@ class fullMatrix
{ {
_data = new scalar[_r * _c]; _data = new scalar[_r * _c];
_own_data = true; _own_data = true;
setAll(0.); setAll(scalar(0.));
} }
fullMatrix(int r, int c, double *data) fullMatrix(int r, int c, double *data)
: _r(r), _c(c), _data(data), _own_data(false) : _r(r), _c(c), _data(data), _own_data(false)
{ {
setAll(0.); setAll(scalar(0.));
} }
fullMatrix(const fullMatrix<scalar> &other) : _r(other._r), _c(other._c) fullMatrix(const fullMatrix<scalar> &other) : _r(other._r), _c(other._c)
{ {
...@@ -249,13 +249,13 @@ class fullMatrix ...@@ -249,13 +249,13 @@ class fullMatrix
_data = new scalar[_r * _c]; _data = new scalar[_r * _c];
_own_data = true; _own_data = true;
if(resetValue) if(resetValue)
setAll(0.); setAll(scalar(0.));
return true; return true;
} }
_r = r; _r = r;
_c = c; _c = c;
if(resetValue) if(resetValue)
setAll(0.); setAll(scalar(0.));
return false; // no reallocation return false; // no reallocation
} }
void setAsProxy(const fullMatrix<scalar> &original) void setAsProxy(const fullMatrix<scalar> &original)
...@@ -328,7 +328,7 @@ class fullMatrix ...@@ -328,7 +328,7 @@ class fullMatrix
} }
void mult_naive(const fullMatrix<scalar> &b, fullMatrix<scalar> &c) const void mult_naive(const fullMatrix<scalar> &b, fullMatrix<scalar> &c) const
{ {
c.scale(0.); c.scale(scalar(0.));
for(int i = 0; i < _r; i++) for(int i = 0; i < _r; i++)
for(int j = 0; j < b.size2(); j++) for(int j = 0; j < b.size2(); j++)
for(int k = 0; k < _c; k++) for(int k = 0; k < _c; k++)
...@@ -384,7 +384,7 @@ class fullMatrix ...@@ -384,7 +384,7 @@ class fullMatrix
#if !defined(HAVE_BLAS) #if !defined(HAVE_BLAS)
{ {
if(s == 0.) // this is not really correct nan*0 (or inf*0) is expected to give nan if(s == 0.) // this is not really correct nan*0 (or inf*0) is expected to give nan
for(int i = 0; i < _r * _c; ++i) _data[i] = 0.; for(int i = 0; i < _r * _c; ++i) _data[i] = scalar(0.);
else else
for(int i = 0; i < _r * _c; ++i) _data[i] *= s; for(int i = 0; i < _r * _c; ++i) _data[i] *= s;
} }
...@@ -409,7 +409,7 @@ class fullMatrix ...@@ -409,7 +409,7 @@ class fullMatrix
void mult(const fullVector<scalar> &x, fullVector<scalar> &y) const void mult(const fullVector<scalar> &x, fullVector<scalar> &y) const
#if !defined(HAVE_BLAS) #if !defined(HAVE_BLAS)
{ {
y.scale(0.); y.scale(scalar(0.));
for(int i = 0; i < _r; i++) for(int i = 0; i < _r; i++)
for(int j = 0; j < _c; j++) for(int j = 0; j < _c; j++)
y._data[i] += (*this)(i, j) * x(j); y._data[i] += (*this)(i, j) * x(j);
...@@ -495,7 +495,7 @@ class fullMatrix ...@@ -495,7 +495,7 @@ class fullMatrix
#if !defined(HAVE_LAPACK) #if !defined(HAVE_LAPACK)
{ {
Msg::Error("Determinant computation requires LAPACK"); Msg::Error("Determinant computation requires LAPACK");
return 0.; return scalar(0.);
} }
#endif #endif
; ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment