//#####################################################################
// Copyright 2013.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class GMRES
//#####################################################################
#ifndef __GMRES__
#define __GMRES__

#include <Core/Krylov_Solvers/KRYLOV_SOLVER.h>
namespace PhysBAM{

template<class T>
class GMRES:public KRYLOV_SOLVER<T>
{
    typedef KRYLOV_SOLVER<T> BASE;
public:
    using BASE::restart_iterations;using BASE::residual_magnitude_squared;using BASE::iterations_used;using BASE::print_diagnostics;using BASE::print_residuals;
    using BASE::nullspace_measure;using BASE::nullspace_tolerance;using BASE::Solve;using BASE::Ensure_Size;
    using BASE::relative_tolerance;

    bool ensure_convergence;

    GMRES() :ensure_convergence(false)
    {}

    virtual ~GMRES();

//#####################################################################
    bool Solve(const KRYLOV_SYSTEM_BASE<T>& system,KRYLOV_VECTOR_BASE<T>& x,const KRYLOV_VECTOR_BASE<T>& b,
        ARRAY<KRYLOV_VECTOR_BASE<T>*>& av,T tolerance,const int min_iterations,const int max_iterations) override;
    void Print_Diagnostics(int iterations);
//#####################################################################
};
}
#endif
