diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/BiCgStab.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/BiCgStab.cs
index d2701c99..0474e696 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/BiCgStab.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/BiCgStab.cs
@@ -88,7 +88,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
///
/// The iterative process controller.
///
- IIterator _iterator;
+ Iterator _iterator;
///
/// Indicates if the user has stopped the solver.
@@ -99,7 +99,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public BiCgStab()
@@ -115,18 +115,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public BiCgStab(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public BiCgStab(Iterator iterator)
: this(null, iterator)
{
}
@@ -135,7 +135,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -149,19 +149,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public BiCgStab(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public BiCgStab(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -177,10 +177,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -460,19 +460,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// true if continue, otherwise false
bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
///
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/CompositeSolver.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/CompositeSolver.cs
index 0ab0abd8..798ee066 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/CompositeSolver.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/CompositeSolver.cs
@@ -44,6 +44,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
using Complex = Numerics.Complex;
#else
using Complex = System.Numerics.Complex;
+
#endif
///
@@ -64,6 +65,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
public sealed class CompositeSolver : IIterativeSolver
{
#region Internal class - DoubleComparer
+
///
/// An IComparer used to compare double precision floating points.
///
@@ -88,19 +90,20 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
return x.CompareTo(y, 1);
}
- }
+ }
+
#endregion
///
/// The default status used if the solver is not running.
///
- private static readonly ICalculationStatus NonRunningStatus = new CalculationIndetermined();
+ static readonly ICalculationStatus NonRunningStatus = new CalculationIndetermined();
///
/// The default status used if the solver is running.
///
- private static readonly ICalculationStatus RunningStatus = new CalculationRunning();
-
+ static readonly ICalculationStatus RunningStatus = new CalculationRunning();
+
#if PORTABLE
private static readonly Dictionary>> SolverSetups = new Dictionary>>();
#else
@@ -108,7 +111,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// The collection of iterative solver setups. Stored based on the
/// ratio between the relative speed and relative accuracy.
///
- private static readonly SortedList>> SolverSetups = new SortedList>>(new DoubleComparer());
+ static readonly SortedList>> SolverSetups = new SortedList>>(new DoubleComparer());
#endif
#region Solver information loading methods
@@ -168,7 +171,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
// Now load the assembly with an AssemblyName
var assemblyName = new AssemblyName(assemblyFileName);
var assembly = Assembly.Load(assemblyName.FullName);
-
+
// Can't get this because we checked that the file exists.
// FileNotFoundException --> Can't get this because we checked that the file exists.
@@ -273,7 +276,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
interfaceTypes.Clear();
interfaceTypes.AddRange(type.GetInterfaces());
- if (!interfaceTypes.Any(match => typeof(IIterativeSolverSetup).IsAssignableFrom(match)))
+ if (!interfaceTypes.Any(match => typeof (IIterativeSolverSetup).IsAssignableFrom(match)))
{
continue;
}
@@ -284,7 +287,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
// If something goes wrong we just ignore it and move on with the next type.
// There should probably be a log somewhere indicating that something went wrong?
- setup = (IIterativeSolverSetup)Activator.CreateInstance(type);
+ setup = (IIterativeSolverSetup) Activator.CreateInstance(type);
}
catch (ArgumentException)
{
@@ -324,7 +327,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
}
// Ok we want the solver, so store the object
- var ratio = setup.SolutionSpeed / setup.Reliability;
+ var ratio = setup.SolutionSpeed/setup.Reliability;
if (!SolverSetups.ContainsKey(ratio))
{
SolverSetups.Add(ratio, new List>());
@@ -333,35 +336,35 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
var list = SolverSetups[ratio];
list.Add(setup);
}
- }
+ }
#endregion
///
/// The collection of solvers that will be used to
///
- private readonly List> _solvers = new List>();
+ readonly List> _solvers = new List>();
///
/// The status of the calculation.
///
- private ICalculationStatus _status = NonRunningStatus;
+ ICalculationStatus _status = NonRunningStatus;
///
/// The iterator that is used to control the iteration process.
///
- private IIterator _iterator;
+ Iterator _iterator;
///
/// A flag indicating if the solver has been stopped or not.
///
- private bool _hasBeenStopped;
+ bool _hasBeenStopped;
///
/// The solver that is currently running. Reference is used to be able to stop the
/// solver if the user cancels the solve process.
///
- private IIterativeSolver _currentSolver;
+ IIterativeSolver _currentSolver;
///
/// Initializes a new instance of the class with the default iterator.
@@ -374,7 +377,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Initializes a new instance of the class with the specified iterator.
///
/// The iterator that will be used to control the iteration process.
- public CompositeSolver(IIterator iterator)
+ public CompositeSolver(Iterator iterator)
{
_iterator = iterator;
}
@@ -383,7 +386,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Sets the IIterator that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -393,9 +396,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
///
public ICalculationStatus IterationResult
{
- get
- {
- return _status;
+ get
+ {
+ return _status;
}
}
@@ -409,7 +412,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
_hasBeenStopped = true;
if (_currentSolver != null)
- {
+ {
_currentSolver.StopSolve();
}
}
@@ -501,7 +504,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
try
{
// Reset the iterator and pass it to the solver
- _iterator.ResetToPrecalculationState();
+ _iterator.Reset();
solver.SetIterator(_iterator);
// Start the solver
@@ -519,7 +522,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
}
// There was no fatal breakdown so check the status
- if (_iterator.Status is CalculationConverged)
+ if (_iterator.HasConverged)
{
// We're done
internalResult.CopyTo(result);
@@ -529,7 +532,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
// We're not done
// Either:
// - calculation finished without convergence
- if (_iterator.Status is CalculationStoppedWithoutConvergence)
+ if (_iterator.HasStoppedWithoutConvergence)
{
// Copy the internal result to the result vector and
// continue with the calculation.
@@ -558,7 +561,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
///
/// Load solvers
///
- private void LoadSolvers()
+ void LoadSolvers()
{
if (SolverSetups.Count == 0)
{
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/GpBiCg.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/GpBiCg.cs
index 4bd314b6..fabf3990 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/GpBiCg.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/GpBiCg.cs
@@ -86,7 +86,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
///
/// The iterative process controller.
///
- IIterator _iterator;
+ Iterator _iterator;
///
/// Indicates the number of BiCGStab steps should be taken
@@ -109,7 +109,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public GpBiCg()
@@ -125,18 +125,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public GpBiCg(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public GpBiCg(Iterator iterator)
: this(null, iterator)
{
}
@@ -145,7 +145,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -159,19 +159,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public GpBiCg(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public GpBiCg(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -225,10 +225,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -543,19 +543,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// true if continue, otherwise false
bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
///
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterator.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterator.cs
index ca2dff4f..dbc74e20 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterator.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterator.cs
@@ -51,16 +51,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
///
/// Creates a default iterator with all the objects.
///
- /// A new object.
- public static IIterator CreateDefault()
+ /// A new object.
+ public static Iterator CreateDefault()
{
- var iterator = new Iterator();
- iterator.Add(new FailureStopCriterium());
- iterator.Add(new DivergenceStopCriterium());
- iterator.Add(new IterationCountStopCriterium());
- iterator.Add(new ResidualStopCriterium());
-
- return iterator;
+ return new Iterator(
+ new FailureStopCriterium(),
+ new DivergenceStopCriterium(),
+ new IterationCountStopCriterium(),
+ new ResidualStopCriterium());
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/MlkBiCgStab.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/MlkBiCgStab.cs
index 8cd508b5..cd8acfec 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/MlkBiCgStab.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/MlkBiCgStab.cs
@@ -92,7 +92,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
///
/// The iterative process controller.
///
- IIterator _iterator;
+ Iterator _iterator;
///
/// The collection of starting vectors which are used as the basis for the Krylov sub-space.
@@ -113,7 +113,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public MlkBiCgStab()
@@ -129,18 +129,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public MlkBiCgStab(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public MlkBiCgStab(Iterator iterator)
: this(null, iterator)
{
}
@@ -149,7 +149,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -163,19 +163,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public MlkBiCgStab(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public MlkBiCgStab(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -223,10 +223,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -726,19 +726,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// true if continue, otherwise false
bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
///
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/TFQMR.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/TFQMR.cs
index 302f2b1b..f5e467c1 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/TFQMR.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/TFQMR.cs
@@ -77,7 +77,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
///
/// The iterative process controller.
///
- IIterator _iterator;
+ Iterator _iterator;
///
/// Indicates if the user has stopped the solver.
@@ -88,7 +88,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public TFQMR()
@@ -104,18 +104,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public TFQMR(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public TFQMR(Iterator iterator)
: this(null, iterator)
{
}
@@ -124,7 +124,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -138,19 +138,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public TFQMR(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public TFQMR(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -166,10 +166,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -315,7 +315,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
if (sigma.Real.AlmostEqual(0, 1) && sigma.Imaginary.AlmostEqual(0, 1))
{
// FAIL HERE
- _iterator.IterationCancelled();
+ _iterator.Cancel();
break;
}
@@ -388,7 +388,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
if (rho.Real.AlmostEqual(0, 1) && rho.Imaginary.AlmostEqual(0, 1))
{
// FAIL HERE
- _iterator.IterationCancelled();
+ _iterator.Cancel();
break;
}
@@ -450,19 +450,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// true if continue, otherwise false
bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
///
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/BiCgStab.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/BiCgStab.cs
index ba8d17b2..dcaff85d 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/BiCgStab.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/BiCgStab.cs
@@ -81,7 +81,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
///
/// The iterative process controller.
///
- IIterator _iterator;
+ Iterator _iterator;
///
/// Indicates if the user has stopped the solver.
@@ -92,7 +92,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public BiCgStab()
@@ -108,18 +108,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public BiCgStab(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public BiCgStab(Iterator iterator)
: this(null, iterator)
{
}
@@ -128,7 +128,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -142,19 +142,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public BiCgStab(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public BiCgStab(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -170,10 +170,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -453,19 +453,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// true if continue, otherwise false
bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
///
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/CompositeSolver.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/CompositeSolver.cs
index 9cceea81..07145609 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/CompositeSolver.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/CompositeSolver.cs
@@ -57,6 +57,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
public sealed class CompositeSolver : IIterativeSolver
{
#region Internal class - DoubleComparer
+
///
/// An IComparer used to compare double precision floating points.
///
@@ -81,19 +82,20 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
return x.CompareTo(y, 1);
}
- }
+ }
+
#endregion
///
/// The default status used if the solver is not running.
///
- private static readonly ICalculationStatus NonRunningStatus = new CalculationIndetermined();
+ static readonly ICalculationStatus NonRunningStatus = new CalculationIndetermined();
///
/// The default status used if the solver is running.
///
- private static readonly ICalculationStatus RunningStatus = new CalculationRunning();
-
+ static readonly ICalculationStatus RunningStatus = new CalculationRunning();
+
#if PORTABLE
private static readonly Dictionary>> SolverSetups = new Dictionary>>();
#else
@@ -101,7 +103,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// The collection of iterative solver setups. Stored based on the
/// ratio between the relative speed and relative accuracy.
///
- private static readonly SortedList>> SolverSetups = new SortedList>>(new DoubleComparer());
+ static readonly SortedList>> SolverSetups = new SortedList>>(new DoubleComparer());
#endif
#region Solver information loading methods
@@ -161,7 +163,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
// Now load the assembly with an AssemblyName
var assemblyName = new AssemblyName(assemblyFileName);
var assembly = Assembly.Load(assemblyName.FullName);
-
+
// Can't get this because we checked that the file exists.
// FileNotFoundException --> Can't get this because we checked that the file exists.
@@ -266,7 +268,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
interfaceTypes.Clear();
interfaceTypes.AddRange(type.GetInterfaces());
- if (!interfaceTypes.Any(match => typeof(IIterativeSolverSetup).IsAssignableFrom(match)))
+ if (!interfaceTypes.Any(match => typeof (IIterativeSolverSetup).IsAssignableFrom(match)))
{
continue;
}
@@ -277,7 +279,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
// If something goes wrong we just ignore it and move on with the next type.
// There should probably be a log somewhere indicating that something went wrong?
- setup = (IIterativeSolverSetup)Activator.CreateInstance(type);
+ setup = (IIterativeSolverSetup) Activator.CreateInstance(type);
}
catch (ArgumentException)
{
@@ -317,7 +319,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
}
// Ok we want the solver, so store the object
- var ratio = setup.SolutionSpeed / setup.Reliability;
+ var ratio = setup.SolutionSpeed/setup.Reliability;
if (!SolverSetups.ContainsKey(ratio))
{
SolverSetups.Add(ratio, new List>());
@@ -326,35 +328,35 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
var list = SolverSetups[ratio];
list.Add(setup);
}
- }
+ }
#endregion
///
/// The collection of solvers that will be used to
///
- private readonly List> _solvers = new List>();
+ readonly List> _solvers = new List>();
///
/// The status of the calculation.
///
- private ICalculationStatus _status = NonRunningStatus;
+ ICalculationStatus _status = NonRunningStatus;
///
/// The iterator that is used to control the iteration process.
///
- private IIterator _iterator;
+ Iterator _iterator;
///
/// A flag indicating if the solver has been stopped or not.
///
- private bool _hasBeenStopped;
+ bool _hasBeenStopped;
///
/// The solver that is currently running. Reference is used to be able to stop the
/// solver if the user cancels the solve process.
///
- private IIterativeSolver _currentSolver;
+ IIterativeSolver _currentSolver;
///
/// Initializes a new instance of the class with the default iterator.
@@ -367,7 +369,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Initializes a new instance of the class with the specified iterator.
///
/// The iterator that will be used to control the iteration process.
- public CompositeSolver(IIterator iterator)
+ public CompositeSolver(Iterator iterator)
{
_iterator = iterator;
}
@@ -376,7 +378,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Sets the IIterator that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -386,9 +388,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
///
public ICalculationStatus IterationResult
{
- get
- {
- return _status;
+ get
+ {
+ return _status;
}
}
@@ -402,7 +404,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
_hasBeenStopped = true;
if (_currentSolver != null)
- {
+ {
_currentSolver.StopSolve();
}
}
@@ -494,7 +496,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
try
{
// Reset the iterator and pass it to the solver
- _iterator.ResetToPrecalculationState();
+ _iterator.Reset();
solver.SetIterator(_iterator);
// Start the solver
@@ -512,7 +514,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
}
// There was no fatal breakdown so check the status
- if (_iterator.Status is CalculationConverged)
+ if (_iterator.HasConverged)
{
// We're done
internalResult.CopyTo(result);
@@ -522,7 +524,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
// We're not done
// Either:
// - calculation finished without convergence
- if (_iterator.Status is CalculationStoppedWithoutConvergence)
+ if (_iterator.HasStoppedWithoutConvergence)
{
// Copy the internal result to the result vector and
// continue with the calculation.
@@ -551,7 +553,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
///
/// Load solvers
///
- private void LoadSolvers()
+ void LoadSolvers()
{
if (SolverSetups.Count == 0)
{
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/GpBiCg.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/GpBiCg.cs
index dacaebd8..fdbd57b7 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/GpBiCg.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/GpBiCg.cs
@@ -79,7 +79,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
///
/// The iterative process controller.
///
- IIterator _iterator;
+ Iterator _iterator;
///
/// Indicates the number of BiCGStab steps should be taken
@@ -102,7 +102,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public GpBiCg()
@@ -118,18 +118,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public GpBiCg(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public GpBiCg(Iterator iterator)
: this(null, iterator)
{
}
@@ -138,7 +138,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -152,19 +152,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public GpBiCg(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public GpBiCg(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -218,10 +218,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -541,19 +541,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// true if continue, otherwise false
bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
///
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterator.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterator.cs
index a1bd9630..661704b0 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterator.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterator.cs
@@ -46,16 +46,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
///
/// Creates a default iterator with all the objects.
///
- /// A new object.
- public static IIterator CreateDefault()
+ /// A new object.
+ public static Iterator CreateDefault()
{
- var iterator = new Iterator();
- iterator.Add(new FailureStopCriterium());
- iterator.Add(new DivergenceStopCriterium());
- iterator.Add(new IterationCountStopCriterium());
- iterator.Add(new ResidualStopCriterium());
-
- return iterator;
+ return new Iterator(
+ new FailureStopCriterium(),
+ new DivergenceStopCriterium(),
+ new IterationCountStopCriterium(),
+ new ResidualStopCriterium());
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/MlkBiCgStab.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/MlkBiCgStab.cs
index aeb4832d..9c5b4c3c 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/MlkBiCgStab.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/MlkBiCgStab.cs
@@ -84,7 +84,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
///
/// The iterative process controller.
///
- IIterator _iterator;
+ Iterator _iterator;
///
/// The collection of starting vectors which are used as the basis for the Krylov sub-space.
@@ -105,7 +105,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public MlkBiCgStab()
@@ -121,18 +121,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public MlkBiCgStab(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public MlkBiCgStab(Iterator iterator)
: this(null, iterator)
{
}
@@ -141,7 +141,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -155,19 +155,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public MlkBiCgStab(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public MlkBiCgStab(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -215,10 +215,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -723,19 +723,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// true if continue, otherwise false
bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
///
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/TFQMR.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/TFQMR.cs
index d09398f5..2f206bd0 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/TFQMR.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/TFQMR.cs
@@ -69,7 +69,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
///
/// The iterative process controller.
///
- IIterator _iterator;
+ Iterator _iterator;
///
/// Indicates if the user has stopped the solver.
@@ -80,7 +80,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public TFQMR()
@@ -96,18 +96,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public TFQMR(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public TFQMR(Iterator iterator)
: this(null, iterator)
{
}
@@ -116,7 +116,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -130,19 +130,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public TFQMR(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public TFQMR(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -158,10 +158,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -312,7 +312,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
if (sigma.Real.AlmostEqual(0, 1) && sigma.Imaginary.AlmostEqual(0, 1))
{
// FAIL HERE
- _iterator.IterationCancelled();
+ _iterator.Cancel();
break;
}
@@ -385,7 +385,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
if (rho.Real.AlmostEqual(0, 1) && rho.Imaginary.AlmostEqual(0, 1))
{
// FAIL HERE
- _iterator.IterationCancelled();
+ _iterator.Cancel();
break;
}
@@ -447,19 +447,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// true if continue, otherwise false
bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
///
diff --git a/src/Numerics/LinearAlgebra/Double/Solvers/BiCgStab.cs b/src/Numerics/LinearAlgebra/Double/Solvers/BiCgStab.cs
index c683f00d..9f0b1c5b 100644
--- a/src/Numerics/LinearAlgebra/Double/Solvers/BiCgStab.cs
+++ b/src/Numerics/LinearAlgebra/Double/Solvers/BiCgStab.cs
@@ -70,29 +70,29 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// The status used if there is no status, i.e. the solver hasn't run yet and there is no
/// iterator.
///
- private static readonly ICalculationStatus DefaultStatus = new CalculationIndetermined();
+ static readonly ICalculationStatus DefaultStatus = new CalculationIndetermined();
///
/// The preconditioner that will be used. Can be set to , in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ Iterator _iterator;
///
/// Indicates if the user has stopped the solver.
///
- private bool _hasBeenStopped;
-
+ bool _hasBeenStopped;
+
///
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public BiCgStab() : this(null, null)
@@ -107,18 +107,18 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public BiCgStab(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public BiCgStab(Iterator iterator)
: this(null, iterator)
{
}
@@ -127,7 +127,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -141,19 +141,19 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public BiCgStab(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public BiCgStab(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -169,10 +169,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -182,9 +182,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
public ICalculationStatus IterationResult
{
- get
- {
- return (_iterator != null) ? _iterator.Status : DefaultStatus;
+ get
+ {
+ return (_iterator != null) ? _iterator.Status : DefaultStatus;
}
}
@@ -274,9 +274,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
_preconditioner = new UnitPreconditioner();
}
-
+
_preconditioner.Initialize(matrix);
-
+
// Compute r_0 = b - Ax_0 for some initial guess x_0
// In this case we take x_0 = vector
// This is basically a SAXPY so it could be made a lot faster
@@ -285,7 +285,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
// Choose r~ (for example, r~ = r_0)
var tempResiduals = residuals.Clone();
-
+
// create seven temporary vectors needed to hold temporary
// coefficients. All vectors are mangled in each iteration.
// These are defined here to prevent stressing the garbage collector
@@ -321,7 +321,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
if (iterationNumber != 0)
{
// beta_(i-1) = (rho_(i-1)/rho_(i-2))(alpha_(i-1)/omega(i-1))
- var beta = (currentRho / oldRho) * (alpha / omega);
+ var beta = (currentRho/oldRho)*(alpha/omega);
// p_i = r_(i-1) + beta_(i-1)(p_(i-1) - omega_(i-1) * nu_(i-1))
nu.Multiply(-omega, temp);
@@ -340,12 +340,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
// SOLVE Mp~ = p_i // M = preconditioner
_preconditioner.Approximate(vecP, vecPdash);
-
+
// nu_i = Ap~
matrix.Multiply(vecPdash, nu);
// alpha_i = rho_(i-1)/ (r~^T nu_i) = rho / dotproduct(r~ and nu_i)
- alpha = currentRho * 1 / tempResiduals.DotProduct(nu);
+ alpha = currentRho*1/tempResiduals.DotProduct(nu);
// s = r_(i-1) - alpha_i nu_i
nu.Multiply(-alpha, temp);
@@ -389,7 +389,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
matrix.Multiply(vecSdash, temp);
// omega_i = temp^T s / temp^T temp
- omega = temp.DotProduct(vecS) / temp.DotProduct(temp);
+ omega = temp.DotProduct(vecS)/temp.DotProduct(temp);
// x_i = x_(i-1) + alpha_i p^ + omega_i s^
temp.Multiply(-omega, residuals);
@@ -403,7 +403,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
vecPdash.Multiply(alpha, temp);
result.Add(temp, temp2);
temp2.CopyTo(result);
-
+
// for continuation it is necessary that omega_i != 0.0
// If omega is only 1 ULP from zero then we fail.
if (omega.AlmostEqual(0, 1))
@@ -433,11 +433,11 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Residual values in .
/// Instance of the x.
/// Instance of the b.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
{
// -Ax = residual
matrix.Multiply(x, residual);
-
+
// Do not use residual = residual.Negate() because it creates another object
residual.Multiply(-1, residual);
@@ -453,21 +453,19 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Source .
/// Residual .
/// true if continue, otherwise false
- private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
+ bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
///
diff --git a/src/Numerics/LinearAlgebra/Double/Solvers/CompositeSolver.cs b/src/Numerics/LinearAlgebra/Double/Solvers/CompositeSolver.cs
index c97f0a76..525e476a 100644
--- a/src/Numerics/LinearAlgebra/Double/Solvers/CompositeSolver.cs
+++ b/src/Numerics/LinearAlgebra/Double/Solvers/CompositeSolver.cs
@@ -57,6 +57,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
public sealed class CompositeSolver : IIterativeSolver
{
#region Internal class - DoubleComparer
+
///
/// An IComparer used to compare double precision floating points.
///
@@ -78,19 +79,20 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
return x.CompareTo(y, 1);
}
- }
+ }
+
#endregion
///
/// The default status used if the solver is not running.
///
- private static readonly ICalculationStatus NonRunningStatus = new CalculationIndetermined();
+ static readonly ICalculationStatus NonRunningStatus = new CalculationIndetermined();
///
/// The default status used if the solver is running.
///
- private static readonly ICalculationStatus RunningStatus = new CalculationRunning();
-
+ static readonly ICalculationStatus RunningStatus = new CalculationRunning();
+
#if PORTABLE
private static readonly Dictionary>> SolverSetups = new Dictionary>>();
#else
@@ -98,7 +100,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// The collection of iterative solver setups. Stored based on the
/// ratio between the relative speed and relative accuracy.
///
- private static readonly SortedList>> SolverSetups = new SortedList>>(new DoubleComparer());
+ static readonly SortedList>> SolverSetups = new SortedList>>(new DoubleComparer());
#endif
#region Solver information loading methods
@@ -158,7 +160,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
// Now load the assembly with an AssemblyName
var assemblyName = new AssemblyName(assemblyFileName);
var assembly = Assembly.Load(assemblyName.FullName);
-
+
// Can't get this because we checked that the file exists.
// FileNotFoundException --> Can't get this because we checked that the file exists.
@@ -263,7 +265,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
interfaceTypes.Clear();
interfaceTypes.AddRange(type.GetInterfaces());
- if (!interfaceTypes.Any(match => typeof(IIterativeSolverSetup).IsAssignableFrom(match)))
+ if (!interfaceTypes.Any(match => typeof (IIterativeSolverSetup).IsAssignableFrom(match)))
{
continue;
}
@@ -274,7 +276,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
// If something goes wrong we just ignore it and move on with the next type.
// There should probably be a log somewhere indicating that something went wrong?
- setup = (IIterativeSolverSetup)Activator.CreateInstance(type);
+ setup = (IIterativeSolverSetup) Activator.CreateInstance(type);
}
catch (ArgumentException)
{
@@ -314,7 +316,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
}
// Ok we want the solver, so store the object
- var ratio = setup.SolutionSpeed / setup.Reliability;
+ var ratio = setup.SolutionSpeed/setup.Reliability;
if (!SolverSetups.ContainsKey(ratio))
{
SolverSetups.Add(ratio, new List>());
@@ -323,35 +325,35 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
var list = SolverSetups[ratio];
list.Add(setup);
}
- }
+ }
#endregion
///
/// The collection of solvers that will be used to
///
- private readonly List> _solvers = new List>();
+ readonly List> _solvers = new List>();
///
/// The status of the calculation.
///
- private ICalculationStatus _status = NonRunningStatus;
+ ICalculationStatus _status = NonRunningStatus;
///
/// The iterator that is used to control the iteration process.
///
- private IIterator _iterator;
+ Iterator _iterator;
///
/// A flag indicating if the solver has been stopped or not.
///
- private bool _hasBeenStopped;
+ bool _hasBeenStopped;
///
/// The solver that is currently running. Reference is used to be able to stop the
/// solver if the user cancels the solve process.
///
- private IIterativeSolver _currentSolver;
+ IIterativeSolver _currentSolver;
///
/// Initializes a new instance of the class with the default iterator.
@@ -364,16 +366,16 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Initializes a new instance of the class with the specified iterator.
///
/// The iterator that will be used to control the iteration process.
- public CompositeSolver(IIterator iterator)
+ public CompositeSolver(Iterator iterator)
{
_iterator = iterator;
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -383,9 +385,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
public ICalculationStatus IterationResult
{
- get
- {
- return _status;
+ get
+ {
+ return _status;
}
}
@@ -399,7 +401,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
_hasBeenStopped = true;
if (_currentSolver != null)
- {
+ {
_currentSolver.StopSolve();
}
}
@@ -491,7 +493,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
try
{
// Reset the iterator and pass it to the solver
- _iterator.ResetToPrecalculationState();
+ _iterator.Reset();
solver.SetIterator(_iterator);
// Start the solver
@@ -509,7 +511,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
}
// There was no fatal breakdown so check the status
- if (_iterator.Status is CalculationConverged)
+ if (_iterator.HasConverged)
{
// We're done
internalResult.CopyTo(result);
@@ -519,7 +521,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
// We're not done
// Either:
// - calculation finished without convergence
- if (_iterator.Status is CalculationStoppedWithoutConvergence)
+ if (_iterator.HasStoppedWithoutConvergence)
{
// Copy the internal result to the result vector and
// continue with the calculation.
@@ -548,7 +550,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
/// Load solvers
///
- private void LoadSolvers()
+ void LoadSolvers()
{
if (SolverSetups.Count == 0)
{
diff --git a/src/Numerics/LinearAlgebra/Double/Solvers/GpBiCg.cs b/src/Numerics/LinearAlgebra/Double/Solvers/GpBiCg.cs
index b28e12db..9409d225 100644
--- a/src/Numerics/LinearAlgebra/Double/Solvers/GpBiCg.cs
+++ b/src/Numerics/LinearAlgebra/Double/Solvers/GpBiCg.cs
@@ -68,41 +68,41 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// The status used if there is no status, i.e. the solver hasn't run yet and there is no
/// iterator.
///
- private static readonly ICalculationStatus DefaultStatus = new CalculationIndetermined();
+ static readonly ICalculationStatus DefaultStatus = new CalculationIndetermined();
///
/// The preconditioner that will be used. Can be set to null, in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ Iterator _iterator;
///
/// Indicates the number of BiCGStab steps should be taken
/// before switching.
///
- private int _numberOfBiCgStabSteps = 1;
+ int _numberOfBiCgStabSteps = 1;
///
/// Indicates the number of GPBiCG steps should be taken
/// before switching.
///
- private int _numberOfGpbiCgSteps = 4;
+ int _numberOfGpbiCgSteps = 4;
///
/// Indicates if the user has stopped the solver.
///
- private bool _hasBeenStopped;
+ bool _hasBeenStopped;
///
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public GpBiCg() : this(null, null)
@@ -117,18 +117,18 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public GpBiCg(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public GpBiCg(Iterator iterator)
: this(null, iterator)
{
}
@@ -137,7 +137,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -151,19 +151,19 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public GpBiCg(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public GpBiCg(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -187,7 +187,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
throw new ArgumentOutOfRangeException("value");
}
- _numberOfBiCgStabSteps = value;
+ _numberOfBiCgStabSteps = value;
}
}
@@ -223,10 +223,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -236,7 +236,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
public ICalculationStatus IterationResult
{
- get
+ get
{
return (_iterator != null) ? _iterator.Status : DefaultStatus;
}
@@ -329,7 +329,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
_preconditioner = new UnitPreconditioner();
}
-
+
_preconditioner.Initialize(matrix);
// x_0 is initial guess
@@ -384,7 +384,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
matrix.Multiply(temp, s);
// alpha_k = (r*_0 * r_k) / (r*_0 * s_k)
- var alpha = rdash.DotProduct(residuals) / rdash.DotProduct(s);
+ var alpha = rdash.DotProduct(residuals)/rdash.DotProduct(s);
// y_k = t_(k-1) - r_k - alpha_k * w_(k-1) + alpha_k s_k
s.Subtract(w, temp);
@@ -400,14 +400,14 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
// t_k = r_k - alpha_k s_k
s.Multiply(-alpha, temp2);
residuals.Add(temp2, t);
-
+
// Solve M d_k = t_k
_preconditioner.Approximate(t, temp);
// c_k = A d_k
matrix.Multiply(temp, c);
var cdot = c.DotProduct(c);
-
+
// cDot can only be zero if c is a zero vector
// We'll set cDot to 1 if it is zero to prevent NaN's
// Note that the calculation should continue fine because
@@ -427,7 +427,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
if (((_numberOfBiCgStabSteps == 0) && (iterationNumber == 0)) || ShouldRunBiCgStabSteps(iterationNumber))
{
// sigma_k = (c_k * t_k) / (c_k * c_k)
- sigma = ctdot / cdot;
+ sigma = ctdot/cdot;
// eta_k = 0
eta = 0;
@@ -448,13 +448,13 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
var ytdot = y.DotProduct(t);
var cydot = c.DotProduct(y);
- var denom = (cdot * ydot) - (cydot * cydot);
+ var denom = (cdot*ydot) - (cydot*cydot);
// sigma_k = ((y_k * y_k)(c_k * t_k) - (y_k * t_k)(c_k * y_k)) / ((c_k * c_k)(y_k * y_k) - (y_k * c_k)(c_k * y_k))
- sigma = ((ydot * ctdot) - (ytdot * cydot)) / denom;
+ sigma = ((ydot*ctdot) - (ytdot*cydot))/denom;
// eta_k = ((c_k * c_k)(y_k * t_k) - (y_k * c_k)(c_k * t_k)) / ((c_k * c_k)(y_k * y_k) - (y_k * c_k)(c_k * y_k))
- eta = ((cdot * ytdot) - (cydot * ctdot)) / denom;
+ eta = ((cdot*ytdot) - (cydot*ctdot))/denom;
}
// u_k = sigma_k s_k + eta_k (t_(k-1) - r_k + beta_(k-1) u_(k-1))
@@ -482,7 +482,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
p.Multiply(alpha, temp2);
xtemp.Add(temp2, temp3);
temp3.CopyTo(xtemp);
-
+
xtemp.Add(z, temp3);
temp3.CopyTo(xtemp);
@@ -500,7 +500,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
// beta_k = alpha_k / sigma_k * (r*_0 * r_(k+1)) / (r*_0 * r_k)
// But first we check if there is a possible NaN. If so just reset beta to zero.
- beta = (!sigma.AlmostEqual(0, 1)) ? alpha / sigma * rdash.DotProduct(residuals) / rdash.DotProduct(t0) : 0;
+ beta = (!sigma.AlmostEqual(0, 1)) ? alpha/sigma*rdash.DotProduct(residuals)/rdash.DotProduct(t0) : 0;
// w_k = c_k + beta_k s_k
s.Multiply(beta, temp2);
@@ -529,7 +529,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Residual values in .
/// Instance of the x.
/// Instance of the b.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
{
// -Ax = residual
matrix.Multiply(x, residual);
@@ -547,33 +547,31 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Source .
/// Residual .
/// true if continue, otherwise false
- private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
+ bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
-
+
///
/// Decide if to do steps with BiCgStab
///
/// Number of iteration
/// true if yes, otherwise false
- private bool ShouldRunBiCgStabSteps(int iterationNumber)
+ bool ShouldRunBiCgStabSteps(int iterationNumber)
{
// Run the first steps as BiCGStab
// The number of steps past a whole iteration set
- var difference = iterationNumber % (_numberOfBiCgStabSteps + _numberOfGpbiCgSteps);
+ var difference = iterationNumber%(_numberOfBiCgStabSteps + _numberOfGpbiCgSteps);
// Do steps with BiCGStab if:
// - The difference is zero or more (i.e. we have done zero or more complete cycles)
diff --git a/src/Numerics/LinearAlgebra/Double/Solvers/Iterator.cs b/src/Numerics/LinearAlgebra/Double/Solvers/Iterator.cs
index 05fc6260..b2bd473f 100644
--- a/src/Numerics/LinearAlgebra/Double/Solvers/Iterator.cs
+++ b/src/Numerics/LinearAlgebra/Double/Solvers/Iterator.cs
@@ -44,16 +44,14 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
/// Creates a default iterator with all the objects.
///
- /// A new object.
- public static IIterator CreateDefault()
+ /// A new object.
+ public static Iterator CreateDefault()
{
- var iterator = new Iterator();
- iterator.Add(new FailureStopCriterium());
- iterator.Add(new DivergenceStopCriterium());
- iterator.Add(new IterationCountStopCriterium());
- iterator.Add(new ResidualStopCriterium());
-
- return iterator;
+ return new Iterator(
+ new FailureStopCriterium(),
+ new DivergenceStopCriterium(),
+ new IterationCountStopCriterium(),
+ new ResidualStopCriterium());
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Double/Solvers/MlkBiCgStab.cs b/src/Numerics/LinearAlgebra/Double/Solvers/MlkBiCgStab.cs
index b31a58a7..c703af30 100644
--- a/src/Numerics/LinearAlgebra/Double/Solvers/MlkBiCgStab.cs
+++ b/src/Numerics/LinearAlgebra/Double/Solvers/MlkBiCgStab.cs
@@ -67,45 +67,45 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
/// The default number of starting vectors.
///
- private const int DefaultNumberOfStartingVectors = 50;
-
+ const int DefaultNumberOfStartingVectors = 50;
+
///
/// The status used if there is no status, i.e. the solver hasn't run yet and there is no
/// iterator.
///
- private static readonly ICalculationStatus DefaultStatus = new CalculationIndetermined();
+ static readonly ICalculationStatus DefaultStatus = new CalculationIndetermined();
///
/// The preconditioner that will be used. Can be set to , in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ Iterator _iterator;
///
/// The collection of starting vectors which are used as the basis for the Krylov sub-space.
///
- private IList> _startingVectors;
+ IList> _startingVectors;
///
/// The number of starting vectors used by the algorithm
///
- private int _numberOfStartingVectors = DefaultNumberOfStartingVectors;
+ int _numberOfStartingVectors = DefaultNumberOfStartingVectors;
///
/// Indicates if the user has stopped the solver.
///
- private bool _hasBeenStopped;
+ bool _hasBeenStopped;
///
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public MlkBiCgStab() : this(null, null)
@@ -120,18 +120,18 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public MlkBiCgStab(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public MlkBiCgStab(Iterator iterator)
: this(null, iterator)
{
}
@@ -140,7 +140,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -154,19 +154,19 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public MlkBiCgStab(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public MlkBiCgStab(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -217,10 +217,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -349,7 +349,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
_preconditioner = new UnitPreconditioner();
}
-
+
_preconditioner.Initialize(matrix);
// Choose an initial guess x_0
@@ -403,7 +403,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
var zw = new DenseVector(residuals.Count);
var d = CreateVectorArray(_startingVectors.Count, residuals.Count);
-
+
// g_0 = r_0
var g = CreateVectorArray(_startingVectors.Count, residuals.Count);
residuals.CopyTo(g[k - 1]);
@@ -428,7 +428,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
}
// alpha_(jk+1) = q^T_1 r_((j-1)k+k) / c_((j-1)k+k)
- var alpha = _startingVectors[0].DotProduct(residuals) / c[k - 1];
+ var alpha = _startingVectors[0].DotProduct(residuals)/c[k - 1];
// u_(jk+1) = r_((j-1)k+k) - alpha_(jk+1) w_((j-1)k+k)
w[k - 1].Multiply(-alpha, temp);
@@ -450,7 +450,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
rho = 1.0;
}
- rho = -u.DotProduct(temp) / rho;
+ rho = -u.DotProduct(temp)/rho;
// r_(jk+1) = rho_(j+1) A u~_(jk+1) + u_(jk+1)
u.CopyTo(residuals);
@@ -468,7 +468,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
gtemp.Multiply(alpha, gtemp);
xtemp.Add(gtemp, temp2);
temp2.CopyTo(xtemp);
-
+
// Check convergence and stop if we are converged.
if (!ShouldContinue(iterationNumber, xtemp, input, residuals))
{
@@ -503,7 +503,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
for (var s = i; s < k - 1; s++)
{
// beta^(jk+i)_((j-1)k+s) = -q^t_(s+1) z_d / c_((j-1)k+s)
- beta = -_startingVectors[s + 1].DotProduct(zd) / c[s];
+ beta = -_startingVectors[s + 1].DotProduct(zd)/c[s];
// z_d = z_d + beta^(jk+i)_((j-1)k+s) d_((j-1)k+s)
d[s].Multiply(beta, temp);
@@ -522,7 +522,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
}
}
- beta = rho * c[k - 1];
+ beta = rho*c[k - 1];
if (beta.AlmostEqual(0, 1))
{
throw new Exception("Iterative solver experience a numerical break down");
@@ -531,7 +531,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
// beta^(jk+i)_((j-1)k+k) = -(q^T_1 (r_(jk+1) + rho_(j+1) z_w)) / (rho_(j+1) c_((j-1)k+k))
zw.Multiply(rho, temp2);
residuals.Add(temp2, temp);
- beta = -_startingVectors[0].DotProduct(temp) / beta;
+ beta = -_startingVectors[0].DotProduct(temp)/beta;
// z_g = z_g + beta^(jk+i)_((j-1)k+k) g_((j-1)k+k)
g[k - 1].Multiply(beta, temp);
@@ -551,7 +551,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
for (var s = 0; s < i - 1; s++)
{
// beta^(jk+i)_(jk+s) = -q^T_s+1 z_d / c_(jk+s)
- beta = -_startingVectors[s + 1].DotProduct(zd) / c[s];
+ beta = -_startingVectors[s + 1].DotProduct(zd)/c[s];
// z_d = z_d + beta^(jk+i)_(jk+s) * d_(jk+s)
d[s].Multiply(beta, temp);
@@ -581,7 +581,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
}
// alpha_(jk+i+1) = q^T_(i+1) u_(jk+i) / c_(jk+i)
- alpha = _startingVectors[i + 1].DotProduct(u) / c[i];
+ alpha = _startingVectors[i + 1].DotProduct(u)/c[i];
// u_(jk+i+1) = u_(jk+i) - alpha_(jk+i+1) d_(jk+i)
d[i].Multiply(-alpha, temp);
@@ -592,7 +592,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
_preconditioner.Approximate(g[i], gtemp);
// x_(jk+i+1) = x_(jk+i) + rho_(j+1) alpha_(jk+i+1) g~_(jk+i)
- gtemp.Multiply(rho * alpha, temp);
+ gtemp.Multiply(rho*alpha, temp);
xtemp.Add(temp, temp2);
temp2.CopyTo(xtemp);
@@ -600,7 +600,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
matrix.Multiply(gtemp, w[i]);
// r_(jk+i+1) = r_(jk+i) - rho_(j+1) alpha_(jk+i+1) w_(jk+i)
- w[i].Multiply(-rho * alpha, temp);
+ w[i].Multiply(-rho*alpha, temp);
residuals.Add(temp, temp2);
temp2.CopyTo(residuals);
@@ -627,7 +627,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Maximum number
/// Number of variables
/// Number of starting vectors to create
- private static int NumberOfStartingVectorsToCreate(int maximumNumberOfStartingVectors, int numberOfVariables)
+ static int NumberOfStartingVectorsToCreate(int maximumNumberOfStartingVectors, int numberOfVariables)
{
// Create no more starting vectors than the size of the problem - 1
return Math.Min(maximumNumberOfStartingVectors, (numberOfVariables - 1));
@@ -644,7 +644,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// the is smaller than
/// the .
///
- private static IList> CreateStartingVectors(int maximumNumberOfStartingVectors, int numberOfVariables)
+ static IList> CreateStartingVectors(int maximumNumberOfStartingVectors, int numberOfVariables)
{
// Create no more starting vectors than the size of the problem - 1
// Get random values and then orthogonalize them with
@@ -659,7 +659,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
for (var i = 0; i < matrix.ColumnCount; i++)
{
var samples = distribution.Samples().Take(matrix.RowCount).ToArray();
-
+
// Set the column
matrix.SetColumn(i, samples);
}
@@ -673,9 +673,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
for (var i = 0; i < orthogonalMatrix.ColumnCount; i++)
{
result.Add(orthogonalMatrix.Column(i));
-
+
// Normalize the result vector
- result[i].Multiply(1 / result[i].L2Norm(), result[i]);
+ result[i].Multiply(1/result[i].L2Norm(), result[i]);
}
return result;
@@ -687,7 +687,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Number of vectors
/// Size of each vector
/// Array of random vectors
- private static Vector[] CreateVectorArray(int arraySize, int vectorSize)
+ static Vector[] CreateVectorArray(int arraySize, int vectorSize)
{
var result = new Vector[arraySize];
for (var i = 0; i < result.Length; i++)
@@ -705,7 +705,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Residual data.
/// x data.
/// b data.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
{
// -Ax = residual
matrix.Multiply(x, residual);
@@ -723,21 +723,19 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Source .
/// Residual .
/// true if continue, otherwise false
- private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
+ bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
///
diff --git a/src/Numerics/LinearAlgebra/Double/Solvers/TFQMR.cs b/src/Numerics/LinearAlgebra/Double/Solvers/TFQMR.cs
index cf65e5a4..df93300d 100644
--- a/src/Numerics/LinearAlgebra/Double/Solvers/TFQMR.cs
+++ b/src/Numerics/LinearAlgebra/Double/Solvers/TFQMR.cs
@@ -29,7 +29,6 @@
//
using System;
-using MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
@@ -59,29 +58,29 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// The status used if there is no status, i.e. the solver hasn't run yet and there is no
/// iterator.
///
- private static readonly ICalculationStatus DefaultStatus = new CalculationIndetermined();
+ static readonly ICalculationStatus DefaultStatus = new CalculationIndetermined();
///
/// The preconditioner that will be used. Can be set to , in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ Iterator _iterator;
///
/// Indicates if the user has stopped the solver.
///
- private bool _hasBeenStopped;
+ bool _hasBeenStopped;
///
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings and a default preconditioner.
///
public TFQMR() : this(null, null)
@@ -96,18 +95,18 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// When using this constructor the solver will use a default preconditioner.
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
- /// The that will be used to monitor the iterative process.
- public TFQMR(IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public TFQMR(Iterator iterator)
: this(null, iterator)
{
}
@@ -116,7 +115,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Initializes a new instance of the class.
///
///
- /// When using this constructor the solver will use the with
+ /// When using this constructor the solver will use the with
/// the standard settings.
///
/// The that will be used to precondition the matrix equation.
@@ -130,19 +129,19 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
///
///
- /// The main advantages of using a user defined are:
+ /// The main advantages of using a user defined are:
///
/// - It is possible to set the desired convergence limits.
/// -
/// It is possible to check the reason for which the solver finished
- /// the iterative procedure by calling the property.
+ /// the iterative procedure by calling the property.
///
///
///
///
/// The that will be used to precondition the matrix equation.
- /// The that will be used to monitor the iterative process.
- public TFQMR(IPreConditioner preconditioner, IIterator iterator)
+ /// The that will be used to monitor the iterative process.
+ public TFQMR(IPreConditioner preconditioner, Iterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -158,10 +157,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
}
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(Iterator iterator)
{
_iterator = iterator;
}
@@ -171,9 +170,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
public ICalculationStatus IterationResult
{
- get
- {
- return (_iterator != null) ? _iterator.Status : DefaultStatus;
+ get
+ {
+ return (_iterator != null) ? _iterator.Status : DefaultStatus;
}
}
@@ -296,7 +295,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
// Calculate the initial values for v
// M temp = yEven
_preconditioner.Approximate(yeven, temp);
-
+
// v = A temp
matrix.Multiply(temp, v);
@@ -315,12 +314,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
if (sigma.AlmostEqual(0, 1))
{
// FAIL HERE
- _iterator.IterationCancelled();
+ _iterator.Cancel();
break;
}
// alpha = rho / sigma
- alpha = rho / sigma;
+ alpha = rho/sigma;
// yOdd = yEven - alpha * v
v.Multiply(-alpha, temp1);
@@ -345,18 +344,18 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
temp2.CopyTo(pseudoResiduals);
// d = yOdd + theta * theta * eta / alpha * d
- d.Multiply(theta * theta * eta / alpha, temp);
+ d.Multiply(theta*theta*eta/alpha, temp);
yinternal.Add(temp, d);
// theta = ||pseudoResiduals||_2 / tau
- theta = pseudoResiduals.L2Norm() / tau;
- var c = 1 / Math.Sqrt(1 + (theta * theta));
+ theta = pseudoResiduals.L2Norm()/tau;
+ var c = 1/Math.Sqrt(1 + (theta*theta));
// tau = tau * theta * c
- tau *= theta * c;
+ tau *= theta*c;
// eta = c^2 * alpha
- eta = c * c * alpha;
+ eta = c*c*alpha;
// x = x + eta * d
d.Multiply(eta, temp1);
@@ -388,12 +387,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
if (rho.AlmostEqual(0, 1))
{
// FAIL HERE
- _iterator.IterationCancelled();
+ _iterator.Cancel();
break;
}
var rhoNew = pseudoResiduals.DotProduct(r);
- var beta = rhoNew / rho;
+ var beta = rhoNew/rho;
// Update rho for the next loop
rho = rhoNew;
@@ -430,7 +429,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Residual values in .
/// Instance of the x.
/// Instance of the b.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
{
// -Ax = residual
matrix.Multiply(x, residual);
@@ -448,21 +447,19 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Source .
/// Residual .
/// true if continue, otherwise false
- private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
+ bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
+ // We stop if either:
+ // - the user has stopped the calculation
+ // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
+
if (_hasBeenStopped)
{
- _iterator.IterationCancelled();
+ _iterator.Cancel();
return true;
}
- _iterator.DetermineStatus(iterationNumber, result, source, residuals);
- var status = _iterator.Status;
-
- // We stop if either:
- // - the user has stopped the calculation
- // - the calculation needs to be stopped from a numerical point of view (divergence, convergence etc.)
- return (!status.TerminatesCalculation) && (!_hasBeenStopped);
+ return !_iterator.DetermineStatus(iterationNumber, result, source, residuals).TerminatesCalculation;
}
///
@@ -470,9 +467,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
///
/// Number to check
/// true if even, otherwise false
- private static bool IsEven(int number)
+ static bool IsEven(int number)
{
- return number % 2 == 0;
+ return number%2 == 0;
}
///
diff --git a/src/Numerics/LinearAlgebra/Single/Solvers/BiCgStab.cs b/src/Numerics/LinearAlgebra/Single/Solvers/BiCgStab.cs
index 88b3324c..ea9cc357 100644
--- a/src/Numerics/LinearAlgebra/Single/Solvers/BiCgStab.cs
+++ b/src/Numerics/LinearAlgebra/Single/Solvers/BiCgStab.cs
@@ -70,29 +70,29 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
/// The status used if there is no status, i.e. the solver hasn't run yet and there is no
/// iterator.
///
- private static readonly ICalculationStatus DefaultStatus = new CalculationIndetermined();
+ static readonly ICalculationStatus DefaultStatus = new CalculationIndetermined();
///
/// The preconditioner that will be used. Can be set to , in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ Iterator _iterator;
///