mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-16 06:47:06 +01:00
Adding reproducibility tests
This commit is contained in:
@ -33,17 +33,21 @@ directory
|
||||
|
||||
namespace Grid {
|
||||
|
||||
struct CG_state{
|
||||
bool do_repro;
|
||||
std::vector<RealD> residuals;
|
||||
struct CG_state {
|
||||
bool do_repro;
|
||||
std::vector<RealD> residuals;
|
||||
|
||||
CG_state(){
|
||||
do_repro = false;
|
||||
residuals.clear();}
|
||||
CG_state() {
|
||||
do_repro = false;
|
||||
residuals.clear();
|
||||
}
|
||||
|
||||
void reset(){
|
||||
do_repro = false;
|
||||
residuals.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Base classes for iterative processes based on operators
|
||||
// single input vec, single output vec.
|
||||
@ -57,7 +61,7 @@ class ConjugateGradient : public OperatorFunction<Field> {
|
||||
RealD Tolerance;
|
||||
Integer MaxIterations;
|
||||
bool ReproTest;
|
||||
CG_state CGState;
|
||||
CG_state CGState;//to check reproducibility by repeating the CG
|
||||
|
||||
ConjugateGradient(RealD tol, Integer maxit, bool err_on_no_conv = true,
|
||||
bool ReproducibilityTest = false)
|
||||
@ -199,8 +203,7 @@ class ConjugateGradient : public OperatorFunction<Field> {
|
||||
}
|
||||
|
||||
// Clear state
|
||||
CGState.residuals.clear();
|
||||
CGState.do_repro = false;
|
||||
CGState.reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user