open Algebra open Vector open Matrix (* Signature of an iterative solver *) module type Iterative_Solver = sig type elem type argument type result type norm (* Solve A B e = X if norm (AX - B) < e. do not forget that norm is the square of the real norm *) val solver : elem -> result -> norm -> argument end (* conjugate gradient for symmetric matrices *) module GC (R : Normed_Field) (V : Normed_Vector with type scalar = R.elem and type norm = R.norm) (M : Light_Matrix with type scalar = R.elem and type argument = V.elem and type result = V.elem) : Iterative_Solver with type elem = M.elem and type argument = V.elem and type result = V.elem and type norm = R.norm (* an interesting exemple (look at the code) of a way to apply the GC to a non symmetric matrice *) module Double_GC (R : Normed_Field) (V : Normed_Vector with type scalar = R.elem and type norm = R.norm) (M : Light_Matrix with type scalar = R.elem and type argument = V.elem and type result = V.elem) : Iterative_Solver with type elem = M.elem and type argument = V.elem and type result = V.elem and type norm = R.norm