@@ -54,8 +54,13 @@ public ConjugateGradientSolver() {
54
54
super ();
55
55
}
56
56
57
+ @ Override
57
58
public double resolve (final List <Equation > equations , final PhysicalStore <Double > solution ) {
58
59
60
+ if (this .isDebugPrinterSet ()) {
61
+ this .debug (0 , NaN , solution );
62
+ }
63
+
59
64
int nbEquations = equations .size ();
60
65
61
66
int iterations = 0 ;
@@ -133,13 +138,14 @@ public double resolve(final List<Equation> equations, final PhysicalStore<Double
133
138
this .debug (iterations , normErr / normRHS , solution );
134
139
}
135
140
136
- } while (( iterations < limit ) && !Double .isNaN (normErr ) && !accuracy .isSmall (normRHS , normErr ));
141
+ } while (iterations < limit && !Double .isNaN (normErr ) && !accuracy .isSmall (normRHS , normErr ));
137
142
138
143
// BasicLogger.debug("Done in {} iterations on problem size {}", iterations, solution.count());
139
144
140
145
return normErr / normRHS ;
141
146
}
142
147
148
+ @ Override
143
149
public MatrixStore <Double > solve (final Access2D <?> body , final Access2D <?> rhs , final PhysicalStore <Double > preallocated ) throws RecoverableCondition {
144
150
145
151
List <Equation > equations = IterativeSolverTask .toListOfRows (body , rhs );
@@ -150,7 +156,7 @@ public MatrixStore<Double> solve(final Access2D<?> body, final Access2D<?> rhs,
150
156
}
151
157
152
158
private R064Store direction (final Structure1D structure ) {
153
- if (( myDirection == null ) || ( myDirection .count () != structure .count () )) {
159
+ if (myDirection == null || myDirection .count () != structure .count ()) {
154
160
myDirection = R064Store .FACTORY .make (structure .count (), 1L );
155
161
} else {
156
162
myDirection .fillAll (ZERO );
@@ -159,7 +165,7 @@ private R064Store direction(final Structure1D structure) {
159
165
}
160
166
161
167
private R064Store preconditioned (final Structure1D structure ) {
162
- if (( myPreconditioned == null ) || ( myPreconditioned .count () != structure .count () )) {
168
+ if (myPreconditioned == null || myPreconditioned .count () != structure .count ()) {
163
169
myPreconditioned = R064Store .FACTORY .make (structure .count (), 1L );
164
170
} else {
165
171
myPreconditioned .fillAll (ZERO );
@@ -168,7 +174,7 @@ private R064Store preconditioned(final Structure1D structure) {
168
174
}
169
175
170
176
private R064Store residual (final Structure1D structure ) {
171
- if (( myResidual == null ) || ( myResidual .count () != structure .count () )) {
177
+ if (myResidual == null || myResidual .count () != structure .count ()) {
172
178
myResidual = R064Store .FACTORY .make (structure .count (), 1L );
173
179
} else {
174
180
myResidual .fillAll (ZERO );
@@ -177,7 +183,7 @@ private R064Store residual(final Structure1D structure) {
177
183
}
178
184
179
185
private R064Store vector (final Structure1D structure ) {
180
- if (( myVector == null ) || ( myVector .count () != structure .count () )) {
186
+ if (myVector == null || myVector .count () != structure .count ()) {
181
187
myVector = R064Store .FACTORY .make (structure .count (), 1L );
182
188
} else {
183
189
myVector .fillAll (ZERO );
0 commit comments