mirror of https://github.com/CGAL/cgal
Return an error code instead of asserting to please CGAL test suite
This commit is contained in:
parent
d5f6332ecf
commit
e2e4323dd7
|
|
@ -137,7 +137,8 @@ public:
|
||||||
while ( rTr>err && its < max_iter) {
|
while ( rTr>err && its < max_iter) {
|
||||||
mult(A,d,Ad);
|
mult(A,d,Ad);
|
||||||
rTAd=BLAS<Vector>::dot(rT,Ad);
|
rTAd=BLAS<Vector>::dot(rT,Ad);
|
||||||
assert( ! IsZero(rTAd) );
|
if (IsZero(rTAd))
|
||||||
|
break; // stop if bad conditioning
|
||||||
alpha=rTh/rTAd;
|
alpha=rTh/rTAd;
|
||||||
BLAS<Vector>::axpy(-alpha,Ad,r);
|
BLAS<Vector>::axpy(-alpha,Ad,r);
|
||||||
BLAS<Vector>::copy(h,s);
|
BLAS<Vector>::copy(h,s);
|
||||||
|
|
@ -156,8 +157,10 @@ public:
|
||||||
BLAS<Vector>::axpy(-omega,s,x);
|
BLAS<Vector>::axpy(-omega,s,x);
|
||||||
BLAS<Vector>::copy(s,h);
|
BLAS<Vector>::copy(s,h);
|
||||||
BLAS<Vector>::axpy(-omega,t,h);
|
BLAS<Vector>::axpy(-omega,t,h);
|
||||||
assert( ! IsZero(omega) );
|
if (IsZero(omega))
|
||||||
assert( ! IsZero(rTh) );
|
break; // stop if bad conditioning
|
||||||
|
if (IsZero(rTh))
|
||||||
|
break; // stop if bad conditioning
|
||||||
beta=(alpha/omega)/rTh; rTh=BLAS<Vector>::dot(rT,h); beta*=rTh;
|
beta=(alpha/omega)/rTh; rTh=BLAS<Vector>::dot(rT,h); beta*=rTh;
|
||||||
BLAS<Vector>::scal(beta,d);
|
BLAS<Vector>::scal(beta,d);
|
||||||
BLAS<Vector>::axpy(1,h,d);
|
BLAS<Vector>::axpy(1,h,d);
|
||||||
|
|
|
||||||
|
|
@ -136,11 +136,13 @@ public:
|
||||||
rho=BLAS<Vector>::dot(p,p);
|
rho=BLAS<Vector>::dot(p,p);
|
||||||
sig=BLAS<Vector>::dot(r,p);
|
sig=BLAS<Vector>::dot(r,p);
|
||||||
tau=BLAS<Vector>::dot(g,r);
|
tau=BLAS<Vector>::dot(g,r);
|
||||||
assert( ! IsZero(sig) );
|
if (IsZero(sig))
|
||||||
|
break; // stop if bad conditioning
|
||||||
t=tau/sig;
|
t=tau/sig;
|
||||||
BLAS<Vector>::axpy(t,r,x);
|
BLAS<Vector>::axpy(t,r,x);
|
||||||
BLAS<Vector>::axpy(-t,p,g);
|
BLAS<Vector>::axpy(-t,p,g);
|
||||||
assert( ! IsZero(tau) );
|
if (IsZero(tau))
|
||||||
|
break; // stop if bad conditioning
|
||||||
gam=(t*t*rho-tau)/tau;
|
gam=(t*t*rho-tau)/tau;
|
||||||
BLAS<Vector>::scal(gam,r);
|
BLAS<Vector>::scal(gam,r);
|
||||||
BLAS<Vector>::axpy(1,g,r);
|
BLAS<Vector>::axpy(1,g,r);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue