mirror of
https://github.com/apache/commons-math.git
synced 2025-02-09 11:35:33 +00:00
Changed o.a.c.m3.linear.ConjugateGradient according to MATH-771.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1306133 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
380892dbd0
commit
0bff3901f4
@ -139,10 +139,10 @@ public class ConjugateGradient
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public RealVector solveInPlace(final RealLinearOperator a,
|
||||
final RealLinearOperator minv, final RealVector b, final RealVector x0)
|
||||
final RealLinearOperator m, final RealVector b, final RealVector x0)
|
||||
throws NullArgumentException, NonSquareOperatorException,
|
||||
DimensionMismatchException, MaxCountExceededException {
|
||||
checkParameters(a, minv, b, x0);
|
||||
checkParameters(a, m, b, x0);
|
||||
final IterationManager manager = getIterationManager();
|
||||
// Initialization of default stopping criterion
|
||||
manager.resetIterationCount();
|
||||
@ -163,7 +163,7 @@ public class ConjugateGradient
|
||||
final RealVector rro = RealVector.unmodifiableRealVector(r);
|
||||
double rnorm = r.getNorm();
|
||||
RealVector z;
|
||||
if (minv == null) {
|
||||
if (m == null) {
|
||||
z = r;
|
||||
} else {
|
||||
z = null;
|
||||
@ -182,15 +182,15 @@ public class ConjugateGradient
|
||||
evt = new DefaultIterativeLinearSolverEvent(this,
|
||||
manager.getIterations(), xro, bro, rro, rnorm);
|
||||
manager.fireIterationStartedEvent(evt);
|
||||
if (minv != null) {
|
||||
z = minv.operate(r);
|
||||
if (m != null) {
|
||||
z = m.operate(r);
|
||||
}
|
||||
final double rhoNext = r.dotProduct(z);
|
||||
if (check && (rhoNext <= 0.)) {
|
||||
final NonPositiveDefiniteOperatorException e;
|
||||
e = new NonPositiveDefiniteOperatorException();
|
||||
final ExceptionContext context = e.getContext();
|
||||
context.setValue(OPERATOR, minv);
|
||||
context.setValue(OPERATOR, m);
|
||||
context.setValue(VECTOR, r);
|
||||
throw e;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user