diff --git a/src/Examples/LinearAlgebra/IterativeSolvers/BiCgStabSolver.cs b/src/Examples/LinearAlgebra/IterativeSolvers/BiCgStabSolver.cs
index 48fa620f..bdcb6bba 100644
--- a/src/Examples/LinearAlgebra/IterativeSolvers/BiCgStabSolver.cs
+++ b/src/Examples/LinearAlgebra/IterativeSolvers/BiCgStabSolver.cs
@@ -32,7 +32,6 @@ namespace Examples.LinearAlgebra.IterativeSolvers
using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
- using MathNet.Numerics.LinearAlgebra.Generic.Solvers.StopCriterium;
///
/// BiCGStab Iterative solver
@@ -102,7 +101,7 @@ namespace Examples.LinearAlgebra.IterativeSolvers
var residualStopCriterium = new ResidualStopCriterium(1e-10);
// Create monitor with defined stop criteriums
- var monitor = new Iterator(new IIterationStopCriterium[] { iterationCountStopCriterium, residualStopCriterium });
+ var monitor = new Iterator(new IIterationStopCriterium[] { iterationCountStopCriterium, residualStopCriterium });
// Create Bi-Conjugate Gradient Stabilized solver
var solver = new BiCgStab(monitor);
diff --git a/src/Examples/LinearAlgebra/IterativeSolvers/CompositeSolverExample.cs b/src/Examples/LinearAlgebra/IterativeSolvers/CompositeSolverExample.cs
index 4864de07..7101506f 100644
--- a/src/Examples/LinearAlgebra/IterativeSolvers/CompositeSolverExample.cs
+++ b/src/Examples/LinearAlgebra/IterativeSolvers/CompositeSolverExample.cs
@@ -33,11 +33,9 @@ namespace Examples.LinearAlgebra.IterativeSolvers
using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
- using MathNet.Numerics.LinearAlgebra.Generic.Solvers;
- using MathNet.Numerics.LinearAlgebra.Generic.Solvers.StopCriterium;
///
- /// Сomposite matrix solver
+ /// Composite matrix solver
///
public class CompositeSolverExample : IExample
{
@@ -102,7 +100,7 @@ namespace Examples.LinearAlgebra.IterativeSolvers
var residualStopCriterium = new ResidualStopCriterium(1e-10);
// Create monitor with defined stop criteriums
- var monitor = new Iterator(new IIterationStopCriterium[] { iterationCountStopCriterium, residualStopCriterium });
+ var monitor = new Iterator(new IIterationStopCriterium[] { iterationCountStopCriterium, residualStopCriterium });
// Load all suitable solvers from current assembly. Below in this example, there is user-defined solver
// "class UserBiCgStab : IIterativeSolverSetup" which uses regular BiCgStab solver. But user may create any other solver
@@ -147,7 +145,7 @@ namespace Examples.LinearAlgebra.IterativeSolvers
///
/// Sample of user-defined solver setup
///
- public class UserBiCgStab : IIterativeSolverSetup
+ public class UserBiCgStab : IIterativeSolverSetup
{
///
/// Gets the type of the solver that will be created by this setup object.
@@ -175,8 +173,8 @@ namespace Examples.LinearAlgebra.IterativeSolvers
/// Creates a fully functional iterative solver with the default settings
/// given by this setup.
///
- /// A new .
- public IIterativeSolver CreateNew()
+ /// A new .
+ public IIterativeSolver CreateNew()
{
return new BiCgStab();
}
diff --git a/src/Examples/LinearAlgebra/IterativeSolvers/GpBiCgSolver.cs b/src/Examples/LinearAlgebra/IterativeSolvers/GpBiCgSolver.cs
index 675b6a8f..8d97da9b 100644
--- a/src/Examples/LinearAlgebra/IterativeSolvers/GpBiCgSolver.cs
+++ b/src/Examples/LinearAlgebra/IterativeSolvers/GpBiCgSolver.cs
@@ -32,7 +32,6 @@ namespace Examples.LinearAlgebra.IterativeSolvers
using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
- using MathNet.Numerics.LinearAlgebra.Generic.Solvers.StopCriterium;
///
/// GpBiCg Iterative solver
@@ -100,7 +99,7 @@ namespace Examples.LinearAlgebra.IterativeSolvers
var residualStopCriterium = new ResidualStopCriterium(1e-10);
// Create monitor with defined stop criteriums
- var monitor = new Iterator(new IIterationStopCriterium[] { iterationCountStopCriterium, residualStopCriterium });
+ var monitor = new Iterator(new IIterationStopCriterium[] { iterationCountStopCriterium, residualStopCriterium });
// Create Generalized Product Bi-Conjugate Gradient solver
var solver = new GpBiCg(monitor);
diff --git a/src/Examples/LinearAlgebra/IterativeSolvers/MlkBiCgStabSolver.cs b/src/Examples/LinearAlgebra/IterativeSolvers/MlkBiCgStabSolver.cs
index 8a56f3bf..1f526215 100644
--- a/src/Examples/LinearAlgebra/IterativeSolvers/MlkBiCgStabSolver.cs
+++ b/src/Examples/LinearAlgebra/IterativeSolvers/MlkBiCgStabSolver.cs
@@ -32,7 +32,6 @@ namespace Examples.LinearAlgebra.IterativeSolvers
using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
- using MathNet.Numerics.LinearAlgebra.Generic.Solvers.StopCriterium;
///
/// Multiple-Lanczos Bi-Conjugate Gradient stabilized Iterative solver
@@ -101,7 +100,7 @@ namespace Examples.LinearAlgebra.IterativeSolvers
var residualStopCriterium = new ResidualStopCriterium(1e-10);
// Create monitor with defined stop criteriums
- var monitor = new Iterator(new IIterationStopCriterium[] { iterationCountStopCriterium, residualStopCriterium });
+ var monitor = new Iterator(new IIterationStopCriterium[] { iterationCountStopCriterium, residualStopCriterium });
// Create Multiple-Lanczos Bi-Conjugate Gradient Stabilized solver
var solver = new MlkBiCgStab(monitor);
diff --git a/src/Examples/LinearAlgebra/IterativeSolvers/TFQMRSolver.cs b/src/Examples/LinearAlgebra/IterativeSolvers/TFQMRSolver.cs
index 4938acb8..79d8643a 100644
--- a/src/Examples/LinearAlgebra/IterativeSolvers/TFQMRSolver.cs
+++ b/src/Examples/LinearAlgebra/IterativeSolvers/TFQMRSolver.cs
@@ -32,7 +32,6 @@ namespace Examples.LinearAlgebra.IterativeSolvers
using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
- using MathNet.Numerics.LinearAlgebra.Generic.Solvers.StopCriterium;
///
/// Transpose Free Quasi-Minimal Residual iterative solver
@@ -101,7 +100,7 @@ namespace Examples.LinearAlgebra.IterativeSolvers
var residualStopCriterium = new ResidualStopCriterium(1e-10);
// Create monitor with defined stop criteriums
- var monitor = new Iterator(new IIterationStopCriterium[] { iterationCountStopCriterium, residualStopCriterium });
+ var monitor = new Iterator(new IIterationStopCriterium[] { iterationCountStopCriterium, residualStopCriterium });
// Create Transpose Free Quasi-Minimal Residual solver
var solver = new TFQMR(monitor);
diff --git a/src/MathNet.Numerics.5.1.ReSharper b/src/MathNet.Numerics.5.1.ReSharper
index a11bfa15..46415860 100644
--- a/src/MathNet.Numerics.5.1.ReSharper
+++ b/src/MathNet.Numerics.5.1.ReSharper
@@ -10,7 +10,12 @@
en-US
false
-
+ Criterium
+cancelled
+pre
+preconditioner
+Preconditioners
+indetermined
@@ -238,7 +243,7 @@
- false
+ true
Any
diff --git a/src/Numerics/LinearAlgebra/Generic/Solvers/IIterativeSolver.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/IIterativeSolver.cs
similarity index 80%
rename from src/Numerics/LinearAlgebra/Generic/Solvers/IIterativeSolver.cs
rename to src/Numerics/LinearAlgebra/Complex/Solvers/IIterativeSolver.cs
index 6b32c05c..3f4fbe7e 100644
--- a/src/Numerics/LinearAlgebra/Generic/Solvers/IIterativeSolver.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/IIterativeSolver.cs
@@ -28,18 +28,15 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
+namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
- using System;
- using System.Numerics;
- using Status;
+ using Generic.Solvers.Status;
///
- /// Defines the interface for classes that solve the matrix equation Ax = b in
+ /// Defines the interface for classes that solve the matrix equation Ax = b in
/// an iterative manner.
///
- /// Supported data types are double, single, , and .
- public interface IIterativeSolver where T : struct, IEquatable, IFormattable
+ public interface IIterativeSolver
{
///
/// Stops the solve process.
@@ -50,10 +47,10 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
void StopSolve();
///
- /// Sets the that will be used to track the iterative process.
+ /// Sets the that will be used to track the iterative process.
///
/// The iterator.
- void SetIterator(IIterator iterator);
+ void SetIterator(IIterator iterator);
///
/// Gets the status of the iteration once the calculation is finished.
@@ -67,7 +64,7 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
/// The coefficient matrix, A.
/// The solution vector, b.
/// The result vector, x.
- Vector Solve(Matrix matrix, Vector vector);
+ Vector Solve(Matrix matrix, Vector vector);
///
/// Solves the matrix equation Ax = b, where A is the coefficient matrix, b is the
@@ -76,7 +73,7 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
/// The coefficient matrix, A.
/// The solution vector, b
/// The result vector, x
- void Solve(Matrix matrix, Vector input, Vector result);
+ void Solve(Matrix matrix, Vector input, Vector result);
///
/// Solves the matrix equation AX = B, where A is the coefficient matrix, B is the
@@ -85,7 +82,7 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X.
- Matrix Solve(Matrix matrix, Matrix input);
+ Matrix Solve(Matrix matrix, Matrix input);
///
/// Solves the matrix equation AX = B, where A is the coefficient matrix, B is the
@@ -94,6 +91,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X
- void Solve(Matrix matrix, Matrix input, Matrix result);
+ void Solve(Matrix matrix, Matrix input, Matrix result);
}
}
diff --git a/src/Numerics/LinearAlgebra/Generic/Solvers/IIterativeSolverSetup.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/IIterativeSolverSetup.cs
similarity index 85%
rename from src/Numerics/LinearAlgebra/Generic/Solvers/IIterativeSolverSetup.cs
rename to src/Numerics/LinearAlgebra/Complex/Solvers/IIterativeSolverSetup.cs
index da37cdc2..50bf1783 100644
--- a/src/Numerics/LinearAlgebra/Generic/Solvers/IIterativeSolverSetup.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/IIterativeSolverSetup.cs
@@ -28,18 +28,16 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
+namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
using System;
- using System.Numerics;
///
/// Defines the interface for objects that can create an iterative solver with
/// specific settings. This interface is used to pass iterative solver creation
/// setup information around.
///
- /// Supported data types are double, single, , and .
- public interface IIterativeSolverSetup where T : struct, IEquatable, IFormattable
+ public interface IIterativeSolverSetup
{
///
/// Gets the type of the solver that will be created by this setup object.
@@ -55,8 +53,8 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
/// Creates a fully functional iterative solver with the default settings
/// given by this setup.
///
- /// A new .
- IIterativeSolver CreateNew();
+ /// A new .
+ IIterativeSolver CreateNew();
///
/// Gets the relative speed of the solver.
diff --git a/src/Numerics/LinearAlgebra/Generic/Solvers/IIterator.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/IIterator.cs
similarity index 76%
rename from src/Numerics/LinearAlgebra/Generic/Solvers/IIterator.cs
rename to src/Numerics/LinearAlgebra/Complex/Solvers/IIterator.cs
index a226a43c..99ffad1c 100644
--- a/src/Numerics/LinearAlgebra/Generic/Solvers/IIterator.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/IIterator.cs
@@ -28,44 +28,41 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
+namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
using System;
- using System.Numerics;
- using Status;
+ using Generic.Solvers.Status;
using StopCriterium;
///
/// Defines the base interface for iterators that help control an iterative calculation.
///
- /// Supported data types are double, single, , and .
- public interface IIterator
+ public interface IIterator
#if !SILVERLIGHT
- : ICloneable
+ : ICloneable
#endif
- where T : struct, IEquatable, IFormattable
{
///
- /// Adds an to the internal collection of stop-criteria. Only a
+ /// Adds an to the internal collection of stop-criteria. Only a
/// single stop criterium of each type can be stored.
///
/// The stop criterium to add.
/// Thrown if is .
/// Thrown if is of the same type as an already stored criterium.
- void Add(IIterationStopCriterium stopCriterium);
+ void Add(IIterationStopCriterium stopCriterium);
///
- /// Removes the from the internal collection.
+ /// Removes the from the internal collection.
///
/// The stop criterium that must be removed.
- void Remove(IIterationStopCriterium stopCriterium);
+ void Remove(IIterationStopCriterium stopCriterium);
///
- /// Indicates if the specific stop criterium is stored by the .
+ /// Indicates if the specific stop criterium is stored by the .
///
/// The stop criterium.
- /// true if the contains the stop criterium; otherwise false.
- bool Contains(IIterationStopCriterium stopCriterium);
+ /// true if the contains the stop criterium; otherwise false.
+ bool Contains(IIterationStopCriterium stopCriterium);
///
/// Indicates to the iterator that the iterative process has been cancelled.
@@ -75,7 +72,7 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
///
/// Determines the status of the iterative calculation based on the stop criteria stored
- /// by the current . Status is set to Status field of current object.
+ /// by the current . Status is set to Status field of current object.
///
/// The number of iterations that have passed so far.
/// The vector containing the current solution values.
@@ -86,7 +83,7 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
/// on the invocation of this method. Therefore this method should only be called if the
/// calculation has moved forwards at least one step.
///
- void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector);
+ void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector);
///
/// Gets the current calculation status.
@@ -95,7 +92,7 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
ICalculationStatus Status { get; }
///
- /// Resets the to the pre-calculation state.
+ /// Resets the to the pre-calculation state.
///
///
/// Note to implementers: Invoking this method should not clear the user defined
@@ -105,7 +102,7 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers
void ResetToPrecalculationState();
#if SILVERLIGHT
- IIterator Clone();
+ IIterator Clone();
#endif
}
}
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/BiCgStab.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/BiCgStab.cs
index ca2f2d06..14fe6014 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/BiCgStab.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/BiCgStab.cs
@@ -33,8 +33,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
using System;
using System.Numerics;
using Generic;
- using Generic.Solvers;
- using Generic.Solvers.Preconditioners;
using Generic.Solvers.Status;
using Preconditioners;
using Properties;
@@ -68,7 +66,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// solver.
///
///
- public sealed class BiCgStab : IIterativeSolver
+ public sealed class BiCgStab : IIterativeSolver
{
///
/// The status used if there is no status, i.e. the solver hasn't run yet and there is no
@@ -80,12 +78,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The preconditioner that will be used. Can be set to , in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ private IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ private IIterator _iterator;
///
/// Indicates if the user has stopped the solver.
@@ -96,7 +94,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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)
@@ -111,18 +109,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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) : this(null, iterator)
+ /// The that will be used to monitor the iterative process.
+ public BiCgStab(IIterator iterator) : this(null, iterator)
{
}
@@ -130,11 +128,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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.
- public BiCgStab(IPreConditioner preconditioner) : this(preconditioner, null)
+ /// The that will be used to precondition the matrix equation.
+ public BiCgStab(IPreConditioner preconditioner) : this(preconditioner, null)
{
}
@@ -143,38 +141,38 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
///
///
///
- /// 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 precondition the matrix equation.
+ /// The that will be used to monitor the iterative process.
+ public BiCgStab(IPreConditioner preconditioner, IIterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
}
///
- /// Sets the that will be used to precondition the iterative process.
+ /// Sets the that will be used to precondition the iterative process.
///
/// The preconditioner.
- public void SetPreconditioner(IPreConditioner preconditioner)
+ public void SetPreconditioner(IPreConditioner preconditioner)
{
_preconditioner = preconditioner;
}
///
- /// 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(IIterator iterator)
{
_iterator = iterator;
}
@@ -205,17 +203,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Solves the matrix equation Ax = b, where A is the coefficient matrix, b is the
/// solution vector and x is the unknown vector.
///
- /// The coefficient , A.
- /// The solution , b.
- /// The result , x.
- public Vector Solve(Matrix matrix, Vector vector)
+ /// The coefficient , A.
+ /// The solution , b.
+ /// The result , x.
+ public Vector Solve(Matrix matrix, Vector vector)
{
if (vector == null)
{
throw new ArgumentNullException();
}
- Vector result = new DenseVector(matrix.RowCount);
+ Vector result = new DenseVector(matrix.RowCount);
Solve(matrix, vector, result);
return result;
}
@@ -224,10 +222,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Solves the matrix equation Ax = b, where A is the coefficient matrix, b is the
/// solution vector and x is the unknown vector.
///
- /// The coefficient , A.
- /// The solution , b.
- /// The result , x.
- public void Solve(Matrix matrix, Vector input, Vector result)
+ /// The coefficient , A.
+ /// The solution , b.
+ /// The result , x.
+ public void Solve(Matrix matrix, Vector input, Vector result)
{
// If we were stopped before, we are no longer
// We're doing this at the start of the method to ensure
@@ -282,7 +280,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
// 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
- Vector residuals = new DenseVector(matrix.RowCount);
+ Vector residuals = new DenseVector(matrix.RowCount);
CalculateTrueResidual(matrix, residuals, result, input);
// Choose r~ (for example, r~ = r_0)
@@ -291,13 +289,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
// 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
- Vector vecP = new DenseVector(residuals.Count);
- Vector vecPdash = new DenseVector(residuals.Count);
- Vector nu = new DenseVector(residuals.Count);
- Vector vecS = new DenseVector(residuals.Count);
- Vector vecSdash = new DenseVector(residuals.Count);
- Vector temp = new DenseVector(residuals.Count);
- Vector temp2 = new DenseVector(residuals.Count);
+ Vector vecP = new DenseVector(residuals.Count);
+ Vector vecPdash = new DenseVector(residuals.Count);
+ Vector nu = new DenseVector(residuals.Count);
+ Vector vecS = new DenseVector(residuals.Count);
+ Vector vecSdash = new DenseVector(residuals.Count);
+ Vector temp = new DenseVector(residuals.Count);
+ Vector temp2 = new DenseVector(residuals.Count);
// create some temporary double variables that are needed
// to hold values in between iterations
@@ -429,13 +427,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
+ /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
///
- /// Instance of the A.
- /// Residual values in .
- /// Instance of the x.
- /// Instance of the b.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ /// Instance of the A.
+ /// Residual values in .
+ /// Instance of the x.
+ /// Instance of the b.
+ private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
{
// -Ax = residual
matrix.Multiply(x, residual);
@@ -451,11 +449,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Determine if calculation should continue
///
/// Number of iterations passed
- /// Result .
- /// Source .
- /// Residual .
+ /// Result .
+ /// Source .
+ /// Residual .
/// true if continue, otherwise false
- private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
+ private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
if (_hasBeenStopped)
{
@@ -476,10 +474,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Solves the matrix equation AX = B, where A is the coefficient matrix, B is the
/// solution matrix and X is the unknown matrix.
///
- /// The coefficient , A.
- /// The solution , B.
- /// The result , X.
- public Matrix Solve(Matrix matrix, Matrix input)
+ /// The coefficient , A.
+ /// The solution , B.
+ /// The result , X.
+ public Matrix Solve(Matrix matrix, Matrix input)
{
if (matrix == null)
{
@@ -491,7 +489,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
throw new ArgumentNullException("input");
}
- var result = matrix.CreateMatrix(input.RowCount, input.ColumnCount);
+ var result = (Matrix)matrix.CreateMatrix(input.RowCount, input.ColumnCount);
Solve(matrix, input, result);
return result;
}
@@ -500,10 +498,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Solves the matrix equation AX = B, where A is the coefficient matrix, B is the
/// solution matrix and X is the unknown matrix.
///
- /// The coefficient , A.
- /// The solution , B.
- /// The result , X
- public void Solve(Matrix matrix, Matrix input, Matrix result)
+ /// The coefficient , A.
+ /// The solution , B.
+ /// The result , X
+ public void Solve(Matrix matrix, Matrix input, Matrix result)
{
if (matrix == null)
{
@@ -527,7 +525,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
for (var column = 0; column < input.ColumnCount; column++)
{
- var solution = Solve(matrix, input.Column(column));
+ var solution = Solve(matrix, (Vector)input.Column(column));
foreach (var element in solution.GetIndexedEnumerator())
{
result.At(element.Key, column, element.Value);
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/CompositeSolver.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/CompositeSolver.cs
index e70c5a95..133c7325 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/CompositeSolver.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/CompositeSolver.cs
@@ -56,7 +56,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Note that if an iterator is passed to this solver it will be used for all the sub-solvers.
///
///
- public sealed class CompositeSolver : IIterativeSolver
+ public sealed class CompositeSolver : IIterativeSolver
{
#region Internal class - DoubleComparer
///
@@ -97,19 +97,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
private static readonly ICalculationStatus RunningStatus = new CalculationRunning();
#if SILVERLIGHT
- private static readonly Dictionary>> SolverSetups = new Dictionary>>();
+ private static readonly Dictionary> SolverSetups = new Dictionary>();
#else
///
/// 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());
+ private static readonly SortedList> SolverSetups = new SortedList>(new DoubleComparer());
#endif
#region Solver information loading methods
///
- /// Loads all the available objects from the MathNet.Numerics assembly.
+ /// Loads all the available objects from the MathNet.Numerics assembly.
///
public static void LoadSolverInformation()
{
@@ -117,16 +117,16 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Loads the available objects from the MathNet.Numerics assembly.
+ /// Loads the available objects from the MathNet.Numerics assembly.
///
- /// The types that should not be loaded.
+ /// The types that should not be loaded.
public static void LoadSolverInformation(Type[] typesToExclude)
{
LoadSolverInformationFromAssembly(Assembly.GetExecutingAssembly(), typesToExclude);
}
///
- /// Loads the available objects from the assembly specified by the file location.
+ /// Loads the available objects from the assembly specified by the file location.
///
/// The fully qualified path to the assembly.
public static void LoadSolverInformationFromAssembly(string assemblyLocation)
@@ -135,10 +135,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Loads the available objects from the assembly specified by the file location.
+ /// Loads the available objects from the assembly specified by the file location.
///
/// The fully qualified path to the assembly.
- /// The types that should not be loaded.
+ /// The types that should not be loaded.
public static void LoadSolverInformationFromAssembly(string assemblyLocation, params Type[] typesToExclude)
{
if (assemblyLocation == null)
@@ -173,7 +173,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Loads the available objects from the assembly specified by the assembly name.
+ /// Loads the available objects from the assembly specified by the assembly name.
///
/// The of the assembly that should be searched for setup objects.
public static void LoadSolverInformationFromAssembly(AssemblyName assemblyName)
@@ -182,10 +182,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Loads the available objects from the assembly specified by the assembly name.
+ /// Loads the available objects from the assembly specified by the assembly name.
///
/// The of the assembly that should be searched for setup objects.
- /// The types that should not be loaded.
+ /// The types that should not be loaded.
public static void LoadSolverInformationFromAssembly(AssemblyName assemblyName, params Type[] typesToExclude)
{
if (assemblyName == null)
@@ -205,7 +205,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Loads the available objects from the assembly specified by the type.
+ /// Loads the available objects from the assembly specified by the type.
///
/// The type in the assembly which should be searched for setup objects.
public static void LoadSolverInformationFromAssembly(Type typeInAssembly)
@@ -214,10 +214,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Loads the available objects from the assembly specified by the type.
+ /// Loads the available objects from the assembly specified by the type.
///
/// The type in the assembly which should be searched for setup objects.
- /// The types that should not be loaded.
+ /// The types that should not be loaded.
public static void LoadSolverInformationFromAssembly(Type typeInAssembly, params Type[] typesToExclude)
{
if (typeInAssembly == null)
@@ -229,7 +229,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Loads the available objects from the specified assembly.
+ /// Loads the available objects from the specified assembly.
///
/// The assembly which will be searched for setup objects.
public static void LoadSolverInformationFromAssembly(Assembly assembly)
@@ -238,10 +238,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Loads the available objects from the specified assembly.
+ /// Loads the available objects from the specified assembly.
///
/// The assembly which will be searched for setup objects.
- /// The types that should not be loaded.
+ /// The types that should not be loaded.
public static void LoadSolverInformationFromAssembly(Assembly assembly, params Type[] typesToExclude)
{
if (assembly == null)
@@ -266,18 +266,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
{
interfaceTypes.Clear();
interfaceTypes.AddRange(type.GetInterfaces());
- if (!interfaceTypes.Any(match => typeof(IIterativeSolverSetup).IsAssignableFrom(match)))
+ if (!interfaceTypes.Any(match => typeof(IIterativeSolverSetup).IsAssignableFrom(match)))
{
continue;
}
// See if we actually want this type of iterative solver
- IIterativeSolverSetup setup;
+ IIterativeSolverSetup setup;
try
{
// 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)
{
@@ -318,7 +318,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
var ratio = setup.SolutionSpeed / setup.Reliability;
if (!SolverSetups.ContainsKey(ratio))
{
- SolverSetups.Add(ratio, new List>());
+ SolverSetups.Add(ratio, new List());
}
var list = SolverSetups[ratio];
@@ -331,7 +331,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
///
/// The collection of solvers that will be used to
///
- private readonly List> _solvers = new List>();
+ private readonly List _solvers = new List();
///
/// The status of the calculation.
@@ -341,7 +341,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
///
/// The iterator that is used to control the iteration process.
///
- private IIterator _iterator;
+ private IIterator _iterator;
///
/// A flag indicating if the solver has been stopped or not.
@@ -352,7 +352,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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;
+ private IIterativeSolver _currentSolver;
///
/// Initializes a new instance of the class with the default iterator.
@@ -365,7 +365,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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(IIterator iterator)
{
_iterator = iterator;
}
@@ -374,7 +374,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Sets the IIterator that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(IIterator iterator)
{
_iterator = iterator;
}
@@ -412,14 +412,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b.
/// The result vector, x.
- public Vector Solve(Matrix matrix, Vector vector)
+ public Vector Solve(Matrix matrix, Vector vector)
{
if (vector == null)
{
throw new ArgumentNullException();
}
- Vector result = new DenseVector(matrix.RowCount);
+ Vector result = new DenseVector(matrix.RowCount);
Solve(matrix, vector, result);
return result;
}
@@ -431,7 +431,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b
/// The result vector, x
- public void Solve(Matrix matrix, Vector input, Vector result)
+ public void Solve(Matrix matrix, Vector input, Vector result)
{
// If we were stopped before, we are no longer
// We're doing this at the start of the method to ensure
@@ -481,8 +481,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
// Create a copy of the solution and result vectors so we can use them
// later on
- var internalInput = input.Clone();
- var internalResult = result.Clone();
+ var internalInput = (Vector)input.Clone();
+ var internalResult = (Vector)result.Clone();
foreach (var solver in _solvers.TakeWhile(solver => !_hasBeenStopped))
{
@@ -573,7 +573,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X.
- public Matrix Solve(Matrix matrix, Matrix input)
+ public Matrix Solve(Matrix matrix, Matrix input)
{
if (matrix == null)
{
@@ -585,7 +585,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
throw new ArgumentNullException("input");
}
- var result = matrix.CreateMatrix(input.RowCount, input.ColumnCount);
+ var result = (Matrix)matrix.CreateMatrix(input.RowCount, input.ColumnCount);
Solve(matrix, input, result);
return result;
}
@@ -597,7 +597,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X
- public void Solve(Matrix matrix, Matrix input, Matrix result)
+ public void Solve(Matrix matrix, Matrix input, Matrix result)
{
if (matrix == null)
{
@@ -621,7 +621,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
for (var column = 0; column < input.ColumnCount; column++)
{
- var solution = Solve(matrix, input.Column(column));
+ var solution = Solve(matrix, (Vector)input.Column(column));
foreach (var element in solution.GetIndexedEnumerator())
{
result.At(element.Key, column, element.Value);
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/GpBiCg.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/GpBiCg.cs
index 58c70cea..53b7e650 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/GpBiCg.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/GpBiCg.cs
@@ -32,9 +32,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
{
using System;
using System.Numerics;
- using Generic;
- using Generic.Solvers;
- using Generic.Solvers.Preconditioners;
using Generic.Solvers.Status;
using Preconditioners;
using Properties;
@@ -66,7 +63,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// solver.
///
///
- public sealed class GpBiCg : IIterativeSolver
+ public sealed class GpBiCg : IIterativeSolver
{
///
/// The status used if there is no status, i.e. the solver hasn't run yet and there is no
@@ -78,12 +75,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The preconditioner that will be used. Can be set to null, in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ private IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ private IIterator _iterator;
///
/// Indicates the number of BiCGStab steps should be taken
@@ -106,7 +103,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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)
@@ -121,18 +118,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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) : this(null, iterator)
+ /// The that will be used to monitor the iterative process.
+ public GpBiCg(IIterator iterator) : this(null, iterator)
{
}
@@ -140,11 +137,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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.
- public GpBiCg(IPreConditioner preconditioner) : this(preconditioner, null)
+ /// The that will be used to precondition the matrix equation.
+ public GpBiCg(IPreConditioner preconditioner) : this(preconditioner, null)
{
}
@@ -153,19 +150,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
///
///
///
- /// 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 precondition the matrix equation.
+ /// The that will be used to monitor the iterative process.
+ public GpBiCg(IPreConditioner preconditioner, IIterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -216,19 +213,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Sets the that will be used to precondition the iterative process.
+ /// Sets the that will be used to precondition the iterative process.
///
/// The preconditioner.
- public void SetPreconditioner(IPreConditioner preconditioner)
+ public void SetPreconditioner(IPreConditioner preconditioner)
{
_preconditioner = preconditioner;
}
///
- /// 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(IIterator iterator)
{
_iterator = iterator;
}
@@ -263,14 +260,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b.
/// The result vector, x.
- public Vector Solve(Matrix matrix, Vector vector)
+ public Vector Solve(Matrix matrix, Vector vector)
{
if (vector == null)
{
throw new ArgumentNullException();
}
- Vector result = new DenseVector(matrix.RowCount);
+ Vector result = new DenseVector(matrix.RowCount);
Solve(matrix, vector, result);
return result;
}
@@ -282,7 +279,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b
/// The result vector, x
- public void Solve(Matrix matrix, Vector input, Vector result)
+ public void Solve(Matrix matrix, Vector input, Vector result)
{
// If we were stopped before, we are no longer
// We're doing this at the start of the method to ensure
@@ -336,11 +333,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
// x_0 is initial guess
// Take x_0 = 0
- Vector xtemp = new DenseVector(input.Count);
+ Vector xtemp = new DenseVector(input.Count);
// r_0 = b - Ax_0
// This is basically a SAXPY so it could be made a lot faster
- Vector residuals = new DenseVector(matrix.RowCount);
+ Vector residuals = new DenseVector(matrix.RowCount);
CalculateTrueResidual(matrix, residuals, xtemp, input);
// Define the temporary scalars
@@ -349,26 +346,26 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
// Define the temporary vectors
// rDash_0 = r_0
- Vector rdash = new DenseVector(residuals);
+ Vector rdash = new DenseVector(residuals);
// t_-1 = 0
- Vector t = new DenseVector(residuals.Count);
- Vector t0 = new DenseVector(residuals.Count);
+ Vector t = new DenseVector(residuals.Count);
+ Vector t0 = new DenseVector(residuals.Count);
// w_-1 = 0
- Vector w = new DenseVector(residuals.Count);
+ Vector w = new DenseVector(residuals.Count);
// Define the remaining temporary vectors
- Vector c = new DenseVector(residuals.Count);
- Vector p = new DenseVector(residuals.Count);
- Vector s = new DenseVector(residuals.Count);
- Vector u = new DenseVector(residuals.Count);
- Vector y = new DenseVector(residuals.Count);
- Vector z = new DenseVector(residuals.Count);
+ Vector c = new DenseVector(residuals.Count);
+ Vector p = new DenseVector(residuals.Count);
+ Vector s = new DenseVector(residuals.Count);
+ Vector u = new DenseVector(residuals.Count);
+ Vector y = new DenseVector(residuals.Count);
+ Vector z = new DenseVector(residuals.Count);
- Vector temp = new DenseVector(residuals.Count);
- Vector temp2 = new DenseVector(residuals.Count);
- Vector temp3 = new DenseVector(residuals.Count);
+ Vector temp = new DenseVector(residuals.Count);
+ Vector temp2 = new DenseVector(residuals.Count);
+ Vector temp3 = new DenseVector(residuals.Count);
// for (k = 0, 1, .... )
var iterationNumber = 0;
@@ -525,13 +522,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
+ /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
///
- /// Instance of the A.
- /// Residual values in .
- /// Instance of the x.
- /// Instance of the b.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ /// Instance of the A.
+ /// Residual values in .
+ /// Instance of the x.
+ /// Instance of the b.
+ private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
{
// -Ax = residual
matrix.Multiply(x, residual);
@@ -545,11 +542,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Determine if calculation should continue
///
/// Number of iterations passed
- /// Result .
- /// Source .
- /// Residual .
+ /// Result .
+ /// Source .
+ /// Residual .
/// true if continue, otherwise false
- private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
+ private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
if (_hasBeenStopped)
{
@@ -590,7 +587,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X.
- public Matrix Solve(Matrix matrix, Matrix input)
+ public Matrix Solve(Matrix matrix, Matrix input)
{
if (matrix == null)
{
@@ -602,7 +599,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
throw new ArgumentNullException("input");
}
- var result = matrix.CreateMatrix(input.RowCount, input.ColumnCount);
+ var result = (Matrix)matrix.CreateMatrix(input.RowCount, input.ColumnCount);
Solve(matrix, input, result);
return result;
}
@@ -614,7 +611,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X
- public void Solve(Matrix matrix, Matrix input, Matrix result)
+ public void Solve(Matrix matrix, Matrix input, Matrix result)
{
if (matrix == null)
{
@@ -638,7 +635,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
for (var column = 0; column < input.ColumnCount; column++)
{
- var solution = Solve(matrix, input.Column(column));
+ var solution = Solve(matrix, (Vector)input.Column(column));
foreach (var element in solution.GetIndexedEnumerator())
{
result.At(element.Key, column, element.Value);
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/MlkBiCgStab.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/MlkBiCgStab.cs
index 7671217d..d0b086b7 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/MlkBiCgStab.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/MlkBiCgStab.cs
@@ -38,8 +38,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
using Distributions;
using Generic;
using Generic.Factorization;
- using Generic.Solvers;
- using Generic.Solvers.Preconditioners;
using Generic.Solvers.Status;
using Preconditioners;
using Properties;
@@ -67,7 +65,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// solver.
///
///
- public sealed class MlkBiCgStab : IIterativeSolver
+ public sealed class MlkBiCgStab : IIterativeSolver
{
///
/// The default number of starting vectors.
@@ -84,17 +82,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The preconditioner that will be used. Can be set to , in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ private IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ private IIterator _iterator;
///
/// The collection of starting vectors which are used as the basis for the Krylov sub-space.
///
- private IList> _startingVectors;
+ private IList _startingVectors;
///
/// The number of starting vectors used by the algorithm
@@ -110,7 +108,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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)
@@ -125,18 +123,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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) : this(null, iterator)
+ /// The that will be used to monitor the iterative process.
+ public MlkBiCgStab(IIterator iterator) : this(null, iterator)
{
}
@@ -144,11 +142,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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.
- public MlkBiCgStab(IPreConditioner preconditioner) : this(preconditioner, null)
+ /// The that will be used to precondition the matrix equation.
+ public MlkBiCgStab(IPreConditioner preconditioner) : this(preconditioner, null)
{
}
@@ -157,19 +155,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
///
///
///
- /// 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 precondition the matrix equation.
+ /// The that will be used to monitor the iterative process.
+ public MlkBiCgStab(IPreConditioner preconditioner, IIterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -211,19 +209,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Sets the that will be used to precondition the iterative process.
+ /// Sets the that will be used to precondition the iterative process.
///
/// The preconditioner.
- public void SetPreconditioner(IPreConditioner preconditioner)
+ public void SetPreconditioner(IPreConditioner preconditioner)
{
_preconditioner = preconditioner;
}
///
- /// 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(IIterator iterator)
{
_iterator = iterator;
}
@@ -232,7 +230,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Gets or sets a series of orthonormal vectors which will be used as basis for the
/// Krylov sub-space.
///
- public IList> StartingVectors
+ public IList StartingVectors
{
[DebuggerStepThrough]
get
@@ -284,14 +282,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b.
/// The result vector, x.
- public Vector Solve(Matrix matrix, Vector vector)
+ public Vector Solve(Matrix matrix, Vector vector)
{
if (vector == null)
{
throw new ArgumentNullException();
}
- Vector result = new DenseVector(matrix.RowCount);
+ Vector result = new DenseVector(matrix.RowCount);
Solve(matrix, vector, result);
return result;
}
@@ -303,7 +301,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b
/// The result vector, x
- public void Solve(Matrix matrix, Vector input, Vector result)
+ public void Solve(Matrix matrix, Vector input, Vector result)
{
// If we were stopped before, we are no longer
// We're doing this at the start of the method to ensure
@@ -357,7 +355,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
// Choose an initial guess x_0
// Take x_0 = 0
- Vector xtemp = new DenseVector(input.Count);
+ Vector xtemp = new DenseVector(input.Count);
// Choose k vectors q_1, q_2, ..., q_k
// Build a new set if:
@@ -386,24 +384,24 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
// r_0 = b - Ax_0
// This is basically a SAXPY so it could be made a lot faster
- Vector residuals = new DenseVector(matrix.RowCount);
+ Vector residuals = new DenseVector(matrix.RowCount);
CalculateTrueResidual(matrix, residuals, xtemp, input);
// Define the temporary values
var c = new Complex[k];
// Define the temporary vectors
- Vector gtemp = new DenseVector(residuals.Count);
+ Vector gtemp = new DenseVector(residuals.Count);
- Vector u = new DenseVector(residuals.Count);
- Vector utemp = new DenseVector(residuals.Count);
- Vector temp = new DenseVector(residuals.Count);
- Vector temp1 = new DenseVector(residuals.Count);
- Vector temp2 = new DenseVector(residuals.Count);
+ Vector u = new DenseVector(residuals.Count);
+ Vector utemp = new DenseVector(residuals.Count);
+ Vector temp = new DenseVector(residuals.Count);
+ Vector temp1 = new DenseVector(residuals.Count);
+ Vector temp2 = new DenseVector(residuals.Count);
- Vector zd = new DenseVector(residuals.Count);
- Vector zg = new DenseVector(residuals.Count);
- Vector zw = new DenseVector(residuals.Count);
+ Vector zd = new DenseVector(residuals.Count);
+ Vector zg = new DenseVector(residuals.Count);
+ Vector zw = new DenseVector(residuals.Count);
var d = CreateVectorArray(_startingVectors.Count, residuals.Count);
@@ -647,7 +645,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// the is smaller than
/// the .
///
- private static IList> CreateStartingVectors(int maximumNumberOfStartingVectors, int numberOfVariables)
+ private 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
@@ -658,7 +656,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
// mean = 0 and sd = 1
var distribution = new Normal();
- Matrix matrix = new DenseMatrix(numberOfVariables, count);
+ Matrix matrix = new DenseMatrix(numberOfVariables, count);
for (var i = 0; i < matrix.ColumnCount; i++)
{
var samples = new Complex[matrix.RowCount];
@@ -678,10 +676,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
var orthogonalMatrix = gs.Q;
// Now transfer this to vectors
- var result = new List>();
+ var result = new List();
for (var i = 0; i < orthogonalMatrix.ColumnCount; i++)
{
- result.Add(orthogonalMatrix.Column(i));
+ result.Add((Vector)orthogonalMatrix.Column(i));
// Normalize the result vector
result[i].Multiply(1 / result[i].Norm(2), result[i]);
@@ -696,9 +694,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Number of vectors
/// Size of each vector
/// Array of random vectors
- private static Vector[] CreateVectorArray(int arraySize, int vectorSize)
+ private static Vector[] CreateVectorArray(int arraySize, int vectorSize)
{
- var result = new Vector[arraySize];
+ var result = new Vector[arraySize];
for (var i = 0; i < result.Length; i++)
{
result[i] = new DenseVector(vectorSize);
@@ -708,13 +706,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
+ /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
///
- /// Source A.
- /// Residual data.
- /// x data.
- /// b data.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ /// Source A.
+ /// Residual data.
+ /// x data.
+ /// b data.
+ private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
{
// -Ax = residual
matrix.Multiply(x, residual);
@@ -728,11 +726,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Determine if calculation should continue
///
/// Number of iterations passed
- /// Result .
- /// Source .
- /// Residual .
+ /// Result .
+ /// Source .
+ /// Residual .
/// true if continue, otherwise false
- private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
+ private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
if (_hasBeenStopped)
{
@@ -756,7 +754,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X.
- public Matrix Solve(Matrix matrix, Matrix input)
+ public Matrix Solve(Matrix matrix, Matrix input)
{
if (matrix == null)
{
@@ -768,7 +766,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
throw new ArgumentNullException("input");
}
- var result = matrix.CreateMatrix(input.RowCount, input.ColumnCount);
+ var result = (Matrix)matrix.CreateMatrix(input.RowCount, input.ColumnCount);
Solve(matrix, input, result);
return result;
}
@@ -780,7 +778,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X
- public void Solve(Matrix matrix, Matrix input, Matrix result)
+ public void Solve(Matrix matrix, Matrix input, Matrix result)
{
if (matrix == null)
{
@@ -804,7 +802,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
for (var column = 0; column < input.ColumnCount; column++)
{
- var solution = Solve(matrix, input.Column(column));
+ var solution = Solve(matrix, (Vector)input.Column(column));
foreach (var element in solution.GetIndexedEnumerator())
{
result.At(element.Key, column, element.Value);
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/TFQMR.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/TFQMR.cs
index b8efc344..4d024c83 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/TFQMR.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/TFQMR.cs
@@ -32,9 +32,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
{
using System;
using System.Numerics;
- using Generic;
- using Generic.Solvers;
- using Generic.Solvers.Preconditioners;
using Generic.Solvers.Status;
using Preconditioners;
using Properties;
@@ -56,7 +53,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// solver.
///
///
- public sealed class TFQMR : IIterativeSolver
+ public sealed class TFQMR : IIterativeSolver
{
///
/// The status used if there is no status, i.e. the solver hasn't run yet and there is no
@@ -68,12 +65,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The preconditioner that will be used. Can be set to , in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ private IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ private IIterator _iterator;
///
/// Indicates if the user has stopped the solver.
@@ -84,7 +81,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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)
@@ -99,18 +96,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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) : this(null, iterator)
+ /// The that will be used to monitor the iterative process.
+ public TFQMR(IIterator iterator) : this(null, iterator)
{
}
@@ -118,11 +115,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// 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.
- public TFQMR(IPreConditioner preconditioner) : this(preconditioner, null)
+ /// The that will be used to precondition the matrix equation.
+ public TFQMR(IPreConditioner preconditioner) : this(preconditioner, null)
{
}
@@ -131,38 +128,38 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
///
///
///
- /// 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 precondition the matrix equation.
+ /// The that will be used to monitor the iterative process.
+ public TFQMR(IPreConditioner preconditioner, IIterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
}
///
- /// Sets the that will be used to precondition the iterative process.
+ /// Sets the that will be used to precondition the iterative process.
///
/// The preconditioner.
- public void SetPreconditioner(IPreConditioner preconditioner)
+ public void SetPreconditioner(IPreConditioner preconditioner)
{
_preconditioner = preconditioner;
}
///
- /// 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(IIterator iterator)
{
_iterator = iterator;
}
@@ -196,14 +193,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b.
/// The result vector, x.
- public Vector Solve(Matrix matrix, Vector vector)
+ public Vector Solve(Matrix matrix, Vector vector)
{
if (vector == null)
{
throw new ArgumentNullException();
}
- Vector result = new DenseVector(matrix.RowCount);
+ Vector result = new DenseVector(matrix.RowCount);
Solve(matrix, vector, result);
return result;
}
@@ -215,7 +212,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b
/// The result vector, x
- public void Solve(Matrix matrix, Vector input, Vector result)
+ public void Solve(Matrix matrix, Vector input, Vector result)
{
// If we were stopped before, we are no longer
// We're doing this at the start of the method to ensure
@@ -427,13 +424,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
}
///
- /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
+ /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
///
- /// Instance of the A.
- /// Residual values in .
- /// Instance of the x.
- /// Instance of the b.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ /// Instance of the A.
+ /// Residual values in .
+ /// Instance of the x.
+ /// Instance of the b.
+ private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
{
// -Ax = residual
matrix.Multiply(x, residual);
@@ -447,11 +444,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Determine if calculation should continue
///
/// Number of iterations passed
- /// Result .
- /// Source .
- /// Residual .
+ /// Result .
+ /// Source .
+ /// Residual .
/// true if continue, otherwise false
- private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
+ private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
if (_hasBeenStopped)
{
@@ -485,7 +482,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X.
- public Matrix Solve(Matrix matrix, Matrix input)
+ public Matrix Solve(Matrix matrix, Matrix input)
{
if (matrix == null)
{
@@ -497,7 +494,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
throw new ArgumentNullException("input");
}
- var result = matrix.CreateMatrix(input.RowCount, input.ColumnCount);
+ var result = (Matrix)matrix.CreateMatrix(input.RowCount, input.ColumnCount);
Solve(matrix, input, result);
return result;
}
@@ -509,7 +506,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X
- public void Solve(Matrix matrix, Matrix input, Matrix result)
+ public void Solve(Matrix matrix, Matrix input, Matrix result)
{
if (matrix == null)
{
@@ -533,7 +530,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
for (var column = 0; column < input.ColumnCount; column++)
{
- var solution = Solve(matrix, input.Column(column));
+ var solution = Solve(matrix, (Vector)input.Column(column));
foreach (var element in solution.GetIndexedEnumerator())
{
result.At(element.Key, column, element.Value);
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterator.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterator.cs
index 81c4c76e..c4c75eeb 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Iterator.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Iterator.cs
@@ -33,18 +33,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
using System;
using System.Collections.Generic;
using System.Linq;
- using System.Numerics;
- using Generic;
- using Generic.Solvers;
using Generic.Solvers.Status;
- using Generic.Solvers.StopCriterium;
using Properties;
using StopCriterium;
///
/// An iterator that is used to check if an iterative calculation should continue or stop.
///
- public sealed class Iterator : IIterator
+ public sealed class Iterator : IIterator
{
///
/// The default status for the iterator.
@@ -52,10 +48,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
private static readonly ICalculationStatus DefaultStatus = new CalculationIndetermined();
///
- /// Creates a default iterator with all the objects.
+ /// Creates a default iterator with all the objects.
///
- /// A new object.
- public static IIterator CreateDefault()
+ /// A new object.
+ public static IIterator CreateDefault()
{
var iterator = new Iterator();
iterator.Add(new FailureStopCriterium());
@@ -70,7 +66,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// The collection that holds all the stop criteria and the flag indicating if they should be added
/// to the child iterators.
///
- private readonly Dictionary> _stopCriterias = new Dictionary>();
+ private readonly Dictionary _stopCriterias = new Dictionary();
///
/// The status of the iterator.
@@ -97,7 +93,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// of the stop criteria will be passed on to child iterators.
///
/// Thrown if contains multiple stop criteria of the same type.
- public Iterator(IEnumerable> stopCriteria)
+ public Iterator(IEnumerable stopCriteria)
{
// Add the stop criteria
if (stopCriteria == null)
@@ -112,7 +108,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
}
///
- /// Adds an to the internal collection of stop-criteria. Only a
+ /// Adds an to the internal collection of stop-criteria. Only a
/// single stop criterium of each type can be stored.
///
/// The stop criterium to add.
@@ -121,7 +117,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Thrown if is of the same type as an already
/// stored criterium.
///
- public void Add(IIterationStopCriterium stopCriterium)
+ public void Add(IIterationStopCriterium stopCriterium)
{
if (stopCriterium == null)
{
@@ -138,10 +134,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
}
///
- /// Removes the from the internal collection.
+ /// Removes the from the internal collection.
///
/// The stop criterium that must be removed.
- public void Remove(IIterationStopCriterium stopCriterium)
+ public void Remove(IIterationStopCriterium stopCriterium)
{
if (stopCriterium == null)
{
@@ -158,11 +154,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
}
///
- /// Indicates if the specific stop criterium is stored by the .
+ /// Indicates if the specific stop criterium is stored by the .
///
/// The stop criterium.
- /// true if the contains the stop criterium; otherwise false.
- public bool Contains(IIterationStopCriterium stopCriterium)
+ /// true if the contains the stop criterium; otherwise false.
+ public bool Contains(IIterationStopCriterium stopCriterium)
{
return stopCriterium != null && _stopCriterias.ContainsKey(stopCriterium.GetType());
}
@@ -183,7 +179,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Gets an IEnumerator that enumerates over all the stored stop criteria.
///
/// Used for testing only.
- internal IEnumerator> StoredStopCriteria
+ internal IEnumerator StoredStopCriteria
{
get
{
@@ -216,7 +212,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// on the invocation of this method. Therefore this method should only be called if the
/// calculation has moved forwards at least one step.
///
- public void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector)
+ public void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector)
{
if (_stopCriterias.Count == 0)
{
@@ -288,7 +284,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
}
///
- /// Resets the to the pre-calculation state.
+ /// Resets the to the pre-calculation state.
///
public void ResetToPrecalculationState()
{
@@ -309,9 +305,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Creates a deep clone of the current iterator.
///
/// The deep clone of the current iterator.
- public IIterator Clone()
+ public IIterator Clone()
{
- var stopCriteria = _stopCriterias.Select(pair => pair.Value).Select(stopCriterium => (IIterationStopCriterium)stopCriterium.Clone()).ToList();
+ var stopCriteria = _stopCriterias.Select(pair => pair.Value).Select(stopCriterium => (IIterationStopCriterium)stopCriterium.Clone()).ToList();
return new Iterator(stopCriteria);
}
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/Diagonal.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/Diagonal.cs
index 5f5ea777..3a985957 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/Diagonal.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/Diagonal.cs
@@ -32,15 +32,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
{
using System;
using System.Numerics;
- using Generic;
- using Generic.Solvers.Preconditioners;
using Properties;
///
/// A diagonal preconditioner. The preconditioner uses the inverse
/// of the matrix diagonal as preconditioning values.
///
- public sealed class Diagonal : IPreConditioner
+ public sealed class Diagonal : IPreConditioner
{
///
/// The inverse of the matrix diagonal.
@@ -66,10 +64,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// Initializes the preconditioner and loads the internal data structures.
///
///
- /// The upon which this preconditioner is based.
+ /// The upon which this preconditioner is based.
/// If is .
/// If is not a square matrix.
- public void Initialize(Matrix matrix)
+ public void Initialize(Matrix matrix)
{
if (matrix == null)
{
@@ -93,7 +91,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
///
/// The right hand side vector.
/// The left hand side vector.
- public Vector Approximate(Vector rhs)
+ public Vector Approximate(Vector rhs)
{
if (rhs == null)
{
@@ -110,7 +108,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rhs");
}
- Vector result = new DenseVector(rhs.Count);
+ Vector result = new DenseVector(rhs.Count);
Approximate(rhs, result);
return result;
}
@@ -120,7 +118,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
///
/// The right hand side vector.
/// The left hand side vector. Also known as the result vector.
- public void Approximate(Vector rhs, Vector lhs)
+ public void Approximate(Vector rhs, Vector lhs)
{
if (rhs == null)
{
diff --git a/src/Numerics/LinearAlgebra/Generic/Solvers/Preconditioners/IPreConditioner.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/IPreConditioner.cs
similarity index 86%
rename from src/Numerics/LinearAlgebra/Generic/Solvers/Preconditioners/IPreConditioner.cs
rename to src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/IPreConditioner.cs
index 70fc8e0c..b542ceac 100644
--- a/src/Numerics/LinearAlgebra/Generic/Solvers/Preconditioners/IPreConditioner.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/IPreConditioner.cs
@@ -28,11 +28,8 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers.Preconditioners
+namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
{
- using System;
- using System.Numerics;
-
///
/// The base interface for preconditioner classes.
///
@@ -51,27 +48,26 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers.Preconditioners
/// if the changes occur after creating the preconditioner.
///
///
- /// Supported data types are double, single, , and .
- public interface IPreConditioner where T : struct, IEquatable, IFormattable
+ public interface IPreConditioner
{
///
/// Initializes the preconditioner and loads the internal data structures.
///
/// The matrix on which the preconditioner is based.
- void Initialize(Matrix matrix);
+ void Initialize(Matrix matrix);
///
/// Approximates the solution to the matrix equation Mx = b.
///
/// The right hand side vector.
/// The left hand side vector.
- Vector Approximate(Vector rhs);
+ Vector Approximate(Vector rhs);
///
/// Approximates the solution to the matrix equation Mx = b.
///
/// The right hand side vector.
/// The left hand side vector. Also known as the result vector.
- void Approximate(Vector rhs, Vector lhs);
+ void Approximate(Vector rhs, Vector lhs);
}
}
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/Ilutp.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/Ilutp.cs
index e13fd38b..8cc07747 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/Ilutp.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/Ilutp.cs
@@ -33,8 +33,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
using System;
using System.Collections.Generic;
using System.Numerics;
- using Generic;
- using Generic.Solvers.Preconditioners;
using Properties;
///
@@ -54,7 +52,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// pp. 20 - 28
/// Algorithm is described in Section 2, page 22
///
- public sealed class Ilutp : IPreConditioner
+ public sealed class Ilutp : IPreConditioner
{
///
/// The default fill level.
@@ -258,9 +256,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// This method is used for debugging purposes only and should normally not be used.
///
/// A new matrix containing the upper triagonal elements.
- internal Matrix UpperTriangle()
+ internal Matrix UpperTriangle()
{
- return _upper.Clone();
+ return (Matrix)_upper.Clone();
}
///
@@ -270,9 +268,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// This method is used for debugging purposes only and should normally not be used.
///
/// A new matrix containing the lower triagonal elements.
- internal Matrix LowerTriangle()
+ internal Matrix LowerTriangle()
{
- return _lower.Clone();
+ return (Matrix)_lower.Clone();
}
///
@@ -298,13 +296,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// Initializes the preconditioner and loads the internal data structures.
///
///
- /// The upon which this preconditioner is based. Note that the
+ /// The upon which this preconditioner is based. Note that the
/// method takes a general matrix type. However internally the data is stored
/// as a sparse matrix. Therefore it is not recommended to pass a dense matrix.
///
/// If is .
/// If is not a square matrix.
- public void Initialize(Matrix matrix)
+ public void Initialize(Matrix matrix)
{
if (matrix == null)
{
@@ -376,8 +374,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
_pivots[i] = i;
}
- Vector workVector = new DenseVector(sparseMatrix.RowCount);
- Vector rowVector = new DenseVector(sparseMatrix.ColumnCount);
+ Vector workVector = new DenseVector(sparseMatrix.RowCount);
+ Vector rowVector = new DenseVector(sparseMatrix.ColumnCount);
var indexSorting = new int[sparseMatrix.RowCount];
// spaceLeft = lfilNnz * nnz(A)
@@ -532,8 +530,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
///
/// Pivot elements in the according to internal pivot array
///
- /// Row to pivot in
- private void PivotRow(Vector row)
+ /// Row to pivot in
+ private void PivotRow(Vector row)
{
var knownPivots = new Dictionary();
@@ -580,12 +578,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
}
///
- /// Swap columns in the
+ /// Swap columns in the
///
- /// Source .
+ /// Source .
/// First column index to swap
/// Second column index to swap
- private static void SwapColumns(Matrix matrix, int firstColumn, int secondColumn)
+ private static void SwapColumns(Matrix matrix, int firstColumn, int secondColumn)
{
for (var i = 0; i < matrix.RowCount; i++)
{
@@ -601,8 +599,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// Start sort form
/// Sort till upper bound
/// Array with sorted vector indicies
- /// Source
- private static void FindLargestItems(int lowerBound, int upperBound, int[] sortedIndices, Vector values)
+ /// Source
+ private static void FindLargestItems(int lowerBound, int upperBound, int[] sortedIndices, Vector values)
{
// Copy the indices for the values into the array
for (var i = 0; i < upperBound + 1 - lowerBound; i++)
@@ -627,7 +625,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
///
/// The right hand side vector.
/// The left hand side vector.
- public Vector Approximate(Vector rhs)
+ public Vector Approximate(Vector rhs)
{
if (rhs == null)
{
@@ -644,7 +642,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rhs");
}
- Vector result = new DenseVector(rhs.Count);
+ Vector result = new DenseVector(rhs.Count);
Approximate(rhs, result);
return result;
}
@@ -654,7 +652,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
///
/// The right hand side vector.
/// The left hand side vector. Also known as the result vector.
- public void Approximate(Vector rhs, Vector lhs)
+ public void Approximate(Vector rhs, Vector lhs)
{
if (rhs == null)
{
@@ -679,7 +677,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
// Solve equation here
// Pivot(vector, result);
// Solve L*Y = B(piv,:)
- Vector rowValues = new DenseVector(_lower.RowCount);
+ Vector rowValues = new DenseVector(_lower.RowCount);
for (var i = 0; i < _lower.RowCount; i++)
{
_lower.Row(i, rowValues);
@@ -709,17 +707,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
// We have a column pivot so we only need to pivot the
// end result not the incoming right hand side vector
- var temp = lhs.Clone();
+ var temp = (Vector)lhs.Clone();
Pivot(temp, lhs);
}
///
- /// Pivot elements in accoring to internal pivot array
+ /// Pivot elements in according to internal pivot array
///
- /// Source .
- /// Result after pivoting.
- private void Pivot(Vector vector, Vector result)
+ /// Source .
+ /// Result after pivoting.
+ private void Pivot(Vector vector, Vector result)
{
for (var i = 0; i < _pivots.Length; i++)
{
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/IlutpElementSorter.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/IlutpElementSorter.cs
index b073af57..fa06ddd4 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/IlutpElementSorter.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/IlutpElementSorter.cs
@@ -95,7 +95,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// Build heap for double indicies
///
/// Root position
- /// Lenght of
+ /// Length of
/// Indicies of
/// Target
private static void BuildDoubleIndexHeap(int start, int count, int[] sortedIndices, Vector values)
@@ -113,15 +113,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// Indicies of
/// Target
/// Root position
- /// Lenght of
+ /// Length of
private static void SiftDoubleIndices(int[] sortedIndices, Vector values, int begin, int count)
{
var root = begin;
- int child;
while (root * 2 < count)
{
- child = root * 2;
+ var child = root * 2;
if ((child < count - 1) && (values[sortedIndices[child]].Magnitude > values[sortedIndices[child + 1]].Magnitude))
{
child += 1;
@@ -171,7 +170,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
///
/// Target values array
/// Root position
- /// Lenght of
+ /// Length of
private static void BuildHeap(int[] values, int start, int count)
{
while (start >= 0)
@@ -186,15 +185,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
///
/// Target value array
/// Root position
- /// Lenght of
+ /// Length of
private static void Sift(int[] values, int start, int count)
{
var root = start;
- int child;
while (root * 2 < count)
{
- child = root * 2;
+ var child = root * 2;
if ((child < count - 1) && (values[child] > values[child + 1]))
{
child += 1;
@@ -216,8 +214,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// Exchange values in array
///
/// Target values array
- /// First value to exchanghe
- /// Second value to exchanghe
+ /// First value to exchange
+ /// Second value to exchange
private static void Exchange(int[] values, int first, int second)
{
var t = values[first];
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/IncompleteLU.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/IncompleteLU.cs
index ce41969b..b9357ee7 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/IncompleteLU.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/IncompleteLU.cs
@@ -32,8 +32,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
{
using System;
using System.Numerics;
- using Generic;
- using Generic.Solvers.Preconditioners;
using Properties;
///
@@ -45,7 +43,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// Yousef Saad
/// Algorithm is described in Chapter 10, section 10.3.2, page 275
///
- public sealed class IncompleteLU : IPreConditioner
+ public sealed class IncompleteLU : IPreConditioner
{
///
/// The matrix holding the lower (L) and upper (U) matrices. The
@@ -57,7 +55,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// Returns the upper triagonal matrix that was created during the LU decomposition.
///
/// A new matrix containing the upper triagonal elements.
- internal Matrix UpperTriangle()
+ internal Matrix UpperTriangle()
{
var result = new SparseMatrix(_decompositionLU.RowCount);
for (var i = 0; i < _decompositionLU.RowCount; i++)
@@ -75,7 +73,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// Returns the lower triagonal matrix that was created during the LU decomposition.
///
/// A new matrix containing the lower triagonal elements.
- internal Matrix LowerTriangle()
+ internal Matrix LowerTriangle()
{
var result = new SparseMatrix(_decompositionLU.RowCount);
for (var i = 0; i < _decompositionLU.RowCount; i++)
@@ -102,7 +100,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// The matrix upon which the preconditioner is based.
/// If is .
/// If is not a square matrix.
- public void Initialize(Matrix matrix)
+ public void Initialize(Matrix matrix)
{
if (matrix == null)
{
@@ -164,7 +162,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
///
/// The right hand side vector.
/// The left hand side vector.
- public Vector Approximate(Vector rhs)
+ public Vector Approximate(Vector rhs)
{
if (rhs == null)
{
@@ -181,7 +179,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rhs");
}
- Vector result = new DenseVector(rhs.Count);
+ Vector result = new DenseVector(rhs.Count);
Approximate(rhs, result);
return result;
}
@@ -191,7 +189,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
///
/// The right hand side vector.
/// The left hand side vector. Also known as the result vector.
- public void Approximate(Vector rhs, Vector lhs)
+ public void Approximate(Vector rhs, Vector lhs)
{
if (rhs == null)
{
@@ -221,7 +219,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
// z_i = l_ii^-1 * (y_i - SUM_(j rowValues = new DenseVector(_decompositionLU.RowCount);
+ Vector rowValues = new DenseVector(_decompositionLU.RowCount);
for (var i = 0; i < _decompositionLU.RowCount; i++)
{
// Clear the rowValues
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/UnitPreconditioner.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/UnitPreconditioner.cs
index 8520a3a5..fafa0b23 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/UnitPreconditioner.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/UnitPreconditioner.cs
@@ -31,18 +31,14 @@
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
{
using System;
- using System.Numerics;
- using Generic;
- using Generic.Solvers;
- using Generic.Solvers.Preconditioners;
using Properties;
///
/// A unit preconditioner. This preconditioner does not actually do anything
- /// it is only used when running an without
+ /// it is only used when running an without
/// a preconditioner.
///
- internal sealed class UnitPreconditioner : IPreConditioner
+ internal sealed class UnitPreconditioner : IPreConditioner
{
///
/// The coefficient matrix on which this preconditioner operates.
@@ -58,7 +54,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
///
/// If is .
/// If is not a square matrix.
- public void Initialize(Matrix matrix)
+ public void Initialize(Matrix matrix)
{
if (matrix == null)
{
@@ -91,7 +87,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
/// If the size of is different the number of rows of the coefficient matrix.
///
///
- public void Approximate(Vector rhs, Vector lhs)
+ public void Approximate(Vector rhs, Vector lhs)
{
if (rhs == null)
{
@@ -120,7 +116,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
///
/// If the size of is different the number of rows of the coefficient matrix.
///
- public Vector Approximate(Vector rhs)
+ public Vector Approximate(Vector rhs)
{
if (rhs == null)
{
@@ -132,7 +128,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners
throw new ArgumentException(Resources.ArgumentMatrixDimensions);
}
- Vector result = new DenseVector(rhs.Count);
+ Vector result = new DenseVector(rhs.Count);
Approximate(rhs, result);
return result;
}
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/DivergenceStopCriterium.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/DivergenceStopCriterium.cs
index d34600b0..3f0cc784 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/DivergenceStopCriterium.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/DivergenceStopCriterium.cs
@@ -32,15 +32,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
{
using System;
using System.Diagnostics;
- using System.Numerics;
- using Generic;
using Generic.Solvers.Status;
using Generic.Solvers.StopCriterium;
///
/// Monitors an iterative calculation for signs of divergence.
///
- public sealed class DivergenceStopCriterium : IIterationStopCriterium
+ public sealed class DivergenceStopCriterium : IIterationStopCriterium
{
///
/// Default value for the maximum relative increase that the
@@ -208,7 +206,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
///
/// Determines the status of the iterative calculation based on the stop criteria stored
- /// by the current . Result is set into Status field.
+ /// by the current . Result is set into Status field.
///
/// The number of iterations that have passed so far.
/// The vector containing the current solution values.
@@ -219,7 +217,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
/// on the invocation of this method. Therefore this method should only be called if the
/// calculation has moved forwards at least one step.
///
- public void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector)
+ public void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector)
{
if (iterationNumber < 0)
{
@@ -302,7 +300,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
}
///
- /// Gets required history lenght
+ /// Gets required history Length
///
private int RequiredHistoryLength
{
@@ -348,7 +346,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
}
///
- /// Resets the to the pre-calculation state.
+ /// Resets the to the pre-calculation state.
///
public void ResetToPrecalculationState()
{
@@ -359,7 +357,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
///
/// Gets the which indicates what sort of stop criterium this
- /// monitors.
+ /// monitors.
///
/// Returns .
public StopLevel StopLevel
@@ -375,7 +373,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
/// Clones the current and its settings.
///
/// A new instance of the class.
- public IIterationStopCriterium Clone()
+ public IIterationStopCriterium Clone()
{
return new DivergenceStopCriterium(_maximumRelativeIncrease, _minimumNumberOfIterations);
}
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/FailureStopCriterium.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/FailureStopCriterium.cs
index f6f6fc39..176280ba 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/FailureStopCriterium.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/FailureStopCriterium.cs
@@ -32,16 +32,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
{
using System;
using System.Diagnostics;
- using System.Numerics;
- using Generic;
using Generic.Solvers.Status;
using Generic.Solvers.StopCriterium;
using Properties;
///
- /// Defines an that monitors residuals for NaN's.
+ /// Defines an that monitors residuals for NaN's.
///
- public sealed class FailureStopCriterium : IIterationStopCriterium
+ public sealed class FailureStopCriterium : IIterationStopCriterium
{
///
/// Defines the default last iteration number. Set to -1 because iterations normally
@@ -66,7 +64,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
///
/// Determines the status of the iterative calculation based on the stop criteria stored
- /// by the current . Result is set into Status field.
+ /// by the current . Result is set into Status field.
///
/// The number of iterations that have passed so far.
/// The vector containing the current solution values.
@@ -77,7 +75,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
/// on the invocation of this method. Therefore this method should only be called if the
/// calculation has moved forwards at least one step.
///
- public void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector)
+ public void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector)
{
if (iterationNumber < 0)
{
@@ -157,7 +155,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
}
///
- /// Resets the to the pre-calculation state.
+ /// Resets the to the pre-calculation state.
///
public void ResetToPrecalculationState()
{
@@ -167,7 +165,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
///
/// Gets the which indicates what sort of stop criterium this
- /// monitors.
+ /// monitors.
///
/// Returns .
public StopLevel StopLevel
@@ -183,7 +181,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
/// Clones the current and its settings.
///
/// A new instance of the class.
- public IIterationStopCriterium Clone()
+ public IIterationStopCriterium Clone()
{
return new FailureStopCriterium();
}
diff --git a/src/Numerics/LinearAlgebra/Generic/Solvers/StopCriterium/IIterationStopCriterium.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/IIterationStopCriterium.cs
similarity index 79%
rename from src/Numerics/LinearAlgebra/Generic/Solvers/StopCriterium/IIterationStopCriterium.cs
rename to src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/IIterationStopCriterium.cs
index cc1c5893..90237143 100644
--- a/src/Numerics/LinearAlgebra/Generic/Solvers/StopCriterium/IIterationStopCriterium.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/IIterationStopCriterium.cs
@@ -24,36 +24,34 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers.StopCriterium
+namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
{
using System;
- using System.Numerics;
- using Status;
+ using Generic.Solvers.Status;
+ using Generic.Solvers.StopCriterium;
///
/// The base interface for classes that provide stop criteria for iterative calculations.
///
- /// Supported data types are double, single, , and .
- public interface IIterationStopCriterium
+ public interface IIterationStopCriterium
#if !SILVERLIGHT
- : ICloneable
+ : ICloneable
#endif
- where T : struct, IEquatable, IFormattable
{
///
/// Determines the status of the iterative calculation based on the stop criteria stored
- /// by the current . Status is set to Status field of current object.
+ /// by the current . Status is set to Status field of current object.
///
/// The number of iterations that have passed so far.
/// The vector containing the current solution values.
/// The right hand side vector.
/// The vector containing the current residual vectors.
- ///
+ ///
/// The individual stop criteria may internally track the progress of the calculation based
/// on the invocation of this method. Therefore this method should only be called if the
/// calculation has moved forwards at least one step.
///
- void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector);
+ void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector);
///
/// Gets the current calculation status.
@@ -62,7 +60,7 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers.StopCriterium
ICalculationStatus Status { get; }
///
- /// Resets the to the pre-calculation state.
+ /// Resets the to the pre-calculation state.
///
/// To implementers: Invoking this method should not clear the user defined
/// property values, only the state that is used to track the progress of the
@@ -71,12 +69,12 @@ namespace MathNet.Numerics.LinearAlgebra.Generic.Solvers.StopCriterium
///
/// Gets the which indicates what sort of stop criterium this
- /// monitors.
+ /// monitors.
///
StopLevel StopLevel { get; }
#if SILVERLIGHT
- IIterationStopCriterium Clone();
+ IIterationStopCriterium Clone();
#endif
}
}
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/IterationCountStopCriterium.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/IterationCountStopCriterium.cs
index 7199b686..1ecabc32 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/IterationCountStopCriterium.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/IterationCountStopCriterium.cs
@@ -32,16 +32,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
{
using System;
using System.Diagnostics;
- using System.Numerics;
- using Generic;
using Generic.Solvers.Status;
using Generic.Solvers.StopCriterium;
///
- /// Defines an that monitors the numbers of iteration
+ /// Defines an that monitors the numbers of iteration
/// steps as stop criterium.
///
- public sealed class IterationCountStopCriterium : IIterationStopCriterium
+ public sealed class IterationCountStopCriterium : IIterationStopCriterium
{
///
/// The default value for the maximum number of iterations the process is allowed
@@ -132,7 +130,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
/// on the invocation of this method. Therefore this method should only be called if the
/// calculation has moved forwards at least one step.
///
- public void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector)
+ public void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector)
{
if (iterationNumber < 0)
{
@@ -209,7 +207,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
/// Clones the current and its settings.
///
/// A new instance of the class.
- public IIterationStopCriterium Clone()
+ public IIterationStopCriterium Clone()
{
return new IterationCountStopCriterium(_maximumNumberOfIterations);
}
diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/ResidualStopCriterium.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/ResidualStopCriterium.cs
index 153e1806..15471b3e 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/ResidualStopCriterium.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/ResidualStopCriterium.cs
@@ -32,16 +32,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
{
using System;
using System.Diagnostics;
- using System.Numerics;
- using Generic;
using Generic.Solvers.Status;
using Generic.Solvers.StopCriterium;
using Properties;
///
- /// Defines an that monitors residuals as stop criterium.
+ /// Defines an that monitors residuals as stop criterium.
///
- public sealed class ResidualStopCriterium : IIterationStopCriterium
+ public sealed class ResidualStopCriterium : IIterationStopCriterium
{
///
/// The default value for the maximum value of the residual.
@@ -213,7 +211,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
///
/// Determines the status of the iterative calculation based on the stop criteria stored
- /// by the current . Result is set into Status field.
+ /// by the current . Result is set into Status field.
///
/// The number of iterations that have passed so far.
/// The vector containing the current solution values.
@@ -224,7 +222,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
/// on the invocation of this method. Therefore this method should only be called if the
/// calculation has moved forwards at least one step.
///
- public void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector)
+ public void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector)
{
if (iterationNumber < 0)
{
@@ -364,7 +362,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
}
///
- /// Resets the to the pre-calculation state.
+ /// Resets the to the pre-calculation state.
///
public void ResetToPrecalculationState()
{
@@ -375,7 +373,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
///
/// Gets the which indicates what sort of stop criterium this
- /// monitors.
+ /// monitors.
///
/// Returns .
public StopLevel StopLevel
@@ -391,7 +389,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium
/// Clones the current and its settings.
///
/// A new instance of the class.
- public IIterationStopCriterium Clone()
+ public IIterationStopCriterium Clone()
{
return new ResidualStopCriterium(_maximum, _minimumIterationsBelowMaximum);
}
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/IIterativeSolver.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/IIterativeSolver.cs
new file mode 100644
index 00000000..865cc5b2
--- /dev/null
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/IIterativeSolver.cs
@@ -0,0 +1,96 @@
+//
+// Math.NET Numerics, part of the Math.NET Project
+// http://numerics.mathdotnet.com
+// http://github.com/mathnet/mathnet-numerics
+// http://mathnetnumerics.codeplex.com
+//
+// Copyright (c) 2009-2010 Math.NET
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
+{
+ using Generic.Solvers.Status;
+
+ ///
+ /// Defines the interface for classes that solve the matrix equation Ax = b in
+ /// an iterative manner.
+ ///
+ public interface IIterativeSolver
+ {
+ ///
+ /// Stops the solve process.
+ ///
+ ///
+ /// Note that it may take an indetermined amount of time for the solver to actually stop the process.
+ ///
+ void StopSolve();
+
+ ///
+ /// Sets the that will be used to track the iterative process.
+ ///
+ /// The iterator.
+ void SetIterator(IIterator iterator);
+
+ ///
+ /// Gets the status of the iteration once the calculation is finished.
+ ///
+ ICalculationStatus IterationResult { get; }
+
+ ///
+ /// Solves the matrix equation Ax = b, where A is the coefficient matrix, b is the
+ /// solution vector and x is the unknown vector.
+ ///
+ /// The coefficient matrix, A.
+ /// The solution vector, b.
+ /// The result vector, x.
+ Vector Solve(Matrix matrix, Vector vector);
+
+ ///
+ /// Solves the matrix equation Ax = b, where A is the coefficient matrix, b is the
+ /// solution vector and x is the unknown vector.
+ ///
+ /// The coefficient matrix, A.
+ /// The solution vector, b
+ /// The result vector, x
+ void Solve(Matrix matrix, Vector input, Vector result);
+
+ ///
+ /// Solves the matrix equation AX = B, where A is the coefficient matrix, B is the
+ /// solution matrix and X is the unknown matrix.
+ ///
+ /// The coefficient matrix, A.
+ /// The solution matrix, B.
+ /// The result matrix, X.
+ Matrix Solve(Matrix matrix, Matrix input);
+
+ ///
+ /// Solves the matrix equation AX = B, where A is the coefficient matrix, B is the
+ /// solution matrix and X is the unknown matrix.
+ ///
+ /// The coefficient matrix, A.
+ /// The solution matrix, B.
+ /// The result matrix, X
+ void Solve(Matrix matrix, Matrix input, Matrix result);
+ }
+}
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/IIterativeSolverSetup.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/IIterativeSolverSetup.cs
new file mode 100644
index 00000000..f98f5de3
--- /dev/null
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/IIterativeSolverSetup.cs
@@ -0,0 +1,71 @@
+//
+// Math.NET Numerics, part of the Math.NET Project
+// http://numerics.mathdotnet.com
+// http://github.com/mathnet/mathnet-numerics
+// http://mathnetnumerics.codeplex.com
+//
+// Copyright (c) 2009-2010 Math.NET
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
+{
+ using System;
+
+ ///
+ /// Defines the interface for objects that can create an iterative solver with
+ /// specific settings. This interface is used to pass iterative solver creation
+ /// setup information around.
+ ///
+ public interface IIterativeSolverSetup
+ {
+ ///
+ /// Gets the type of the solver that will be created by this setup object.
+ ///
+ Type SolverType { get; }
+
+ ///
+ /// Gets type of preconditioner, if any, that will be created by this setup object.
+ ///
+ Type PreconditionerType { get; }
+
+ ///
+ /// Creates a fully functional iterative solver with the default settings
+ /// given by this setup.
+ ///
+ /// A new .
+ IIterativeSolver CreateNew();
+
+ ///
+ /// Gets the relative speed of the solver.
+ ///
+ /// Returns a value between 0 and 1, inclusive.
+ double SolutionSpeed { get; }
+
+ ///
+ /// Gets the relative reliability of the solver.
+ ///
+ /// Returns a value between 0 and 1 inclusive.
+ double Reliability { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/IIterator.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/IIterator.cs
new file mode 100644
index 00000000..23b0c110
--- /dev/null
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/IIterator.cs
@@ -0,0 +1,108 @@
+//
+// Math.NET Numerics, part of the Math.NET Project
+// http://numerics.mathdotnet.com
+// http://github.com/mathnet/mathnet-numerics
+// http://mathnetnumerics.codeplex.com
+//
+// Copyright (c) 2009-2010 Math.NET
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
+{
+ using System;
+ using Generic.Solvers.Status;
+ using StopCriterium;
+
+ ///
+ /// Defines the base interface for iterators that help control an iterative calculation.
+ ///
+ public interface IIterator
+#if !SILVERLIGHT
+ : ICloneable
+#endif
+ {
+ ///
+ /// Adds an to the internal collection of stop-criteria. Only a
+ /// single stop criterium of each type can be stored.
+ ///
+ /// The stop criterium to add.
+ /// Thrown if is .
+ /// Thrown if is of the same type as an already stored criterium.
+ void Add(IIterationStopCriterium stopCriterium);
+
+ ///
+ /// Removes the from the internal collection.
+ ///
+ /// The stop criterium that must be removed.
+ void Remove(IIterationStopCriterium stopCriterium);
+
+ ///
+ /// Indicates if the specific stop criterium is stored by the .
+ ///
+ /// The stop criterium.
+ /// true if the contains the stop criterium; otherwise false.
+ bool Contains(IIterationStopCriterium stopCriterium);
+
+ ///
+ /// Indicates to the iterator that the iterative process has been cancelled.
+ ///
+ /// Does not reset the stop-criteria.
+ void IterationCancelled();
+
+ ///
+ /// Determines the status of the iterative calculation based on the stop criteria stored
+ /// by the current . Status is set to Status field of current object.
+ ///
+ /// The number of iterations that have passed so far.
+ /// The vector containing the current solution values.
+ /// The right hand side vector.
+ /// The vector containing the current residual vectors.
+ ///
+ /// The individual iterators may internally track the progress of the calculation based
+ /// on the invocation of this method. Therefore this method should only be called if the
+ /// calculation has moved forwards at least one step.
+ ///
+ void DetermineStatus(int iterationNumber, Vector solutionVector, Vector sourceVector, Vector residualVector);
+
+ ///
+ /// Gets the current calculation status.
+ ///
+ /// is not a legal value. Status should be set in implementation..
+ ICalculationStatus Status { get; }
+
+ ///
+ /// Resets the to the pre-calculation state.
+ ///
+ ///
+ /// Note to implementers: Invoking this method should not clear the user defined
+ /// property values, only the state that is used to track the progress of the
+ /// calculation.
+ ///
+ void ResetToPrecalculationState();
+
+#if SILVERLIGHT
+ IIterator Clone();
+#endif
+ }
+}
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/BiCgStab.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/BiCgStab.cs
index 3f832752..b359f19d 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/BiCgStab.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/BiCgStab.cs
@@ -31,9 +31,6 @@
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
{
using System;
- using Generic;
- using Generic.Solvers;
- using Generic.Solvers.Preconditioners;
using Generic.Solvers.Status;
using Numerics;
using Preconditioners;
@@ -68,7 +65,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// solver.
///
///
- public sealed class BiCgStab : IIterativeSolver
+ public sealed class BiCgStab : IIterativeSolver
{
///
/// The status used if there is no status, i.e. the solver hasn't run yet and there is no
@@ -80,12 +77,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The preconditioner that will be used. Can be set to , in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ private IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ private IIterator _iterator;
///
/// Indicates if the user has stopped the solver.
@@ -96,7 +93,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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)
@@ -111,18 +108,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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) : this(null, iterator)
+ /// The that will be used to monitor the iterative process.
+ public BiCgStab(IIterator iterator) : this(null, iterator)
{
}
@@ -130,11 +127,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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.
- public BiCgStab(IPreConditioner preconditioner) : this(preconditioner, null)
+ /// The that will be used to precondition the matrix equation.
+ public BiCgStab(IPreConditioner preconditioner) : this(preconditioner, null)
{
}
@@ -143,38 +140,38 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
///
///
///
- /// 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 precondition the matrix equation.
+ /// The that will be used to monitor the iterative process.
+ public BiCgStab(IPreConditioner preconditioner, IIterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
}
///
- /// Sets the that will be used to precondition the iterative process.
+ /// Sets the that will be used to precondition the iterative process.
///
/// The preconditioner.
- public void SetPreconditioner(IPreConditioner preconditioner)
+ public void SetPreconditioner(IPreConditioner preconditioner)
{
_preconditioner = preconditioner;
}
///
- /// 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(IIterator iterator)
{
_iterator = iterator;
}
@@ -205,17 +202,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Solves the matrix equation Ax = b, where A is the coefficient matrix, b is the
/// solution vector and x is the unknown vector.
///
- /// The coefficient , A.
- /// The solution , b.
- /// The result , x.
- public Vector Solve(Matrix matrix, Vector vector)
+ /// The coefficient , A.
+ /// The solution , b.
+ /// The result , x.
+ public Vector Solve(Matrix matrix, Vector vector)
{
if (vector == null)
{
throw new ArgumentNullException();
}
- Vector result = new DenseVector(matrix.RowCount);
+ Vector result = new DenseVector(matrix.RowCount);
Solve(matrix, vector, result);
return result;
}
@@ -224,10 +221,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Solves the matrix equation Ax = b, where A is the coefficient matrix, b is the
/// solution vector and x is the unknown vector.
///
- /// The coefficient , A.
- /// The solution , b.
- /// The result , x.
- public void Solve(Matrix matrix, Vector input, Vector result)
+ /// The coefficient , A.
+ /// The solution , b.
+ /// The result , x.
+ public void Solve(Matrix matrix, Vector input, Vector result)
{
// If we were stopped before, we are no longer
// We're doing this at the start of the method to ensure
@@ -282,7 +279,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
// 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
- Vector residuals = new DenseVector(matrix.RowCount);
+ Vector residuals = new DenseVector(matrix.RowCount);
CalculateTrueResidual(matrix, residuals, result, input);
// Choose r~ (for example, r~ = r_0)
@@ -291,13 +288,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
// 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
- Vector vecP = new DenseVector(residuals.Count);
- Vector vecPdash = new DenseVector(residuals.Count);
- Vector nu = new DenseVector(residuals.Count);
- Vector vecS = new DenseVector(residuals.Count);
- Vector vecSdash = new DenseVector(residuals.Count);
- Vector temp = new DenseVector(residuals.Count);
- Vector temp2 = new DenseVector(residuals.Count);
+ Vector vecP = new DenseVector(residuals.Count);
+ Vector vecPdash = new DenseVector(residuals.Count);
+ Vector nu = new DenseVector(residuals.Count);
+ Vector vecS = new DenseVector(residuals.Count);
+ Vector vecSdash = new DenseVector(residuals.Count);
+ Vector temp = new DenseVector(residuals.Count);
+ Vector temp2 = new DenseVector(residuals.Count);
// create some temporary float variables that are needed
// to hold values in between iterations
@@ -429,13 +426,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
+ /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
///
- /// Instance of the A.
- /// Residual values in .
- /// Instance of the x.
- /// Instance of the b.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ /// Instance of the A.
+ /// Residual values in .
+ /// Instance of the x.
+ /// Instance of the b.
+ private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
{
// -Ax = residual
matrix.Multiply(x, residual);
@@ -451,11 +448,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Determine if calculation should continue
///
/// Number of iterations passed
- /// Result .
- /// Source .
- /// Residual .
+ /// Result .
+ /// Source .
+ /// Residual .
/// true if continue, otherwise false
- private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
+ private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
if (_hasBeenStopped)
{
@@ -476,10 +473,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Solves the matrix equation AX = B, where A is the coefficient matrix, B is the
/// solution matrix and X is the unknown matrix.
///
- /// The coefficient , A.
- /// The solution , B.
- /// The result , X.
- public Matrix Solve(Matrix matrix, Matrix input)
+ /// The coefficient , A.
+ /// The solution , B.
+ /// The result , X.
+ public Matrix Solve(Matrix matrix, Matrix input)
{
if (matrix == null)
{
@@ -491,7 +488,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
throw new ArgumentNullException("input");
}
- var result = matrix.CreateMatrix(input.RowCount, input.ColumnCount);
+ var result = (Matrix)matrix.CreateMatrix(input.RowCount, input.ColumnCount);
Solve(matrix, input, result);
return result;
}
@@ -500,10 +497,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Solves the matrix equation AX = B, where A is the coefficient matrix, B is the
/// solution matrix and X is the unknown matrix.
///
- /// The coefficient , A.
- /// The solution , B.
- /// The result , X
- public void Solve(Matrix matrix, Matrix input, Matrix result)
+ /// The coefficient , A.
+ /// The solution , B.
+ /// The result , X
+ public void Solve(Matrix matrix, Matrix input, Matrix result)
{
if (matrix == null)
{
@@ -527,7 +524,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
for (var column = 0; column < input.ColumnCount; column++)
{
- var solution = Solve(matrix, input.Column(column));
+ var solution = Solve(matrix, (Vector)input.Column(column));
foreach (var element in solution.GetIndexedEnumerator())
{
result.At(element.Key, column, element.Value);
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/CompositeSolver.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/CompositeSolver.cs
index 47fcdde7..22f868cf 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/CompositeSolver.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/CompositeSolver.cs
@@ -35,10 +35,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
using System.IO;
using System.Linq;
using System.Reflection;
- using Generic;
- using Generic.Solvers;
using Generic.Solvers.Status;
- using Numerics;
using Properties;
///
@@ -56,7 +53,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Note that if an iterator is passed to this solver it will be used for all the sub-solvers.
///
///
- public sealed class CompositeSolver : IIterativeSolver
+ public sealed class CompositeSolver : IIterativeSolver
{
#region Internal class - DoubleComparer
///
@@ -97,19 +94,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
private static readonly ICalculationStatus RunningStatus = new CalculationRunning();
#if SILVERLIGHT
- private static readonly Dictionary>> SolverSetups = new Dictionary>>();
+ private static readonly Dictionary> SolverSetups = new Dictionary>();
#else
///
/// 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());
+ private static readonly SortedList> SolverSetups = new SortedList>(new DoubleComparer());
#endif
#region Solver information loading methods
///
- /// Loads all the available objects from the MathNet.Numerics assembly.
+ /// Loads all the available objects from the MathNet.Numerics assembly.
///
public static void LoadSolverInformation()
{
@@ -117,16 +114,16 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Loads the available objects from the MathNet.Numerics assembly.
+ /// Loads the available objects from the MathNet.Numerics assembly.
///
- /// The types that should not be loaded.
+ /// The types that should not be loaded.
public static void LoadSolverInformation(Type[] typesToExclude)
{
LoadSolverInformationFromAssembly(Assembly.GetExecutingAssembly(), typesToExclude);
}
///
- /// Loads the available objects from the assembly specified by the file location.
+ /// Loads the available objects from the assembly specified by the file location.
///
/// The fully qualified path to the assembly.
public static void LoadSolverInformationFromAssembly(string assemblyLocation)
@@ -135,10 +132,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Loads the available objects from the assembly specified by the file location.
+ /// Loads the available objects from the assembly specified by the file location.
///
/// The fully qualified path to the assembly.
- /// The types that should not be loaded.
+ /// The types that should not be loaded.
public static void LoadSolverInformationFromAssembly(string assemblyLocation, params Type[] typesToExclude)
{
if (assemblyLocation == null)
@@ -173,7 +170,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Loads the available objects from the assembly specified by the assembly name.
+ /// Loads the available objects from the assembly specified by the assembly name.
///
/// The of the assembly that should be searched for setup objects.
public static void LoadSolverInformationFromAssembly(AssemblyName assemblyName)
@@ -182,10 +179,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Loads the available objects from the assembly specified by the assembly name.
+ /// Loads the available objects from the assembly specified by the assembly name.
///
/// The of the assembly that should be searched for setup objects.
- /// The types that should not be loaded.
+ /// The types that should not be loaded.
public static void LoadSolverInformationFromAssembly(AssemblyName assemblyName, params Type[] typesToExclude)
{
if (assemblyName == null)
@@ -205,7 +202,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Loads the available objects from the assembly specified by the type.
+ /// Loads the available objects from the assembly specified by the type.
///
/// The type in the assembly which should be searched for setup objects.
public static void LoadSolverInformationFromAssembly(Type typeInAssembly)
@@ -214,10 +211,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Loads the available objects from the assembly specified by the type.
+ /// Loads the available objects from the assembly specified by the type.
///
/// The type in the assembly which should be searched for setup objects.
- /// The types that should not be loaded.
+ /// The types that should not be loaded.
public static void LoadSolverInformationFromAssembly(Type typeInAssembly, params Type[] typesToExclude)
{
if (typeInAssembly == null)
@@ -229,7 +226,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Loads the available objects from the specified assembly.
+ /// Loads the available objects from the specified assembly.
///
/// The assembly which will be searched for setup objects.
public static void LoadSolverInformationFromAssembly(Assembly assembly)
@@ -238,10 +235,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Loads the available objects from the specified assembly.
+ /// Loads the available objects from the specified assembly.
///
/// The assembly which will be searched for setup objects.
- /// The types that should not be loaded.
+ /// The types that should not be loaded.
public static void LoadSolverInformationFromAssembly(Assembly assembly, params Type[] typesToExclude)
{
if (assembly == null)
@@ -266,18 +263,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
{
interfaceTypes.Clear();
interfaceTypes.AddRange(type.GetInterfaces());
- if (!interfaceTypes.Any(match => typeof(IIterativeSolverSetup).IsAssignableFrom(match)))
+ if (!interfaceTypes.Any(match => typeof(IIterativeSolverSetup).IsAssignableFrom(match)))
{
continue;
}
// See if we actually want this type of iterative solver
- IIterativeSolverSetup setup;
+ IIterativeSolverSetup setup;
try
{
// 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)
{
@@ -318,7 +315,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
var ratio = setup.SolutionSpeed / setup.Reliability;
if (!SolverSetups.ContainsKey(ratio))
{
- SolverSetups.Add(ratio, new List>());
+ SolverSetups.Add(ratio, new List());
}
var list = SolverSetups[ratio];
@@ -331,7 +328,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
///
/// The collection of solvers that will be used to
///
- private readonly List> _solvers = new List>();
+ private readonly List _solvers = new List();
///
/// The status of the calculation.
@@ -341,7 +338,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
///
/// The iterator that is used to control the iteration process.
///
- private IIterator _iterator;
+ private IIterator _iterator;
///
/// A flag indicating if the solver has been stopped or not.
@@ -352,7 +349,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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;
+ private IIterativeSolver _currentSolver;
///
/// Initializes a new instance of the class with the default iterator.
@@ -365,7 +362,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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(IIterator iterator)
{
_iterator = iterator;
}
@@ -374,7 +371,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Sets the IIterator that will be used to track the iterative process.
///
/// The iterator.
- public void SetIterator(IIterator iterator)
+ public void SetIterator(IIterator iterator)
{
_iterator = iterator;
}
@@ -412,14 +409,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b.
/// The result vector, x.
- public Vector Solve(Matrix matrix, Vector vector)
+ public Vector Solve(Matrix matrix, Vector vector)
{
if (vector == null)
{
throw new ArgumentNullException();
}
- Vector result = new DenseVector(matrix.RowCount);
+ Vector result = new DenseVector(matrix.RowCount);
Solve(matrix, vector, result);
return result;
}
@@ -431,7 +428,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b
/// The result vector, x
- public void Solve(Matrix matrix, Vector input, Vector result)
+ public void Solve(Matrix matrix, Vector input, Vector result)
{
// If we were stopped before, we are no longer
// We're doing this at the start of the method to ensure
@@ -481,8 +478,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
// Create a copy of the solution and result vectors so we can use them
// later on
- var internalInput = input.Clone();
- var internalResult = result.Clone();
+ var internalInput = (Vector)input.Clone();
+ var internalResult = (Vector)result.Clone();
foreach (var solver in _solvers.TakeWhile(solver => !_hasBeenStopped))
{
@@ -573,7 +570,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X.
- public Matrix Solve(Matrix matrix, Matrix input)
+ public Matrix Solve(Matrix matrix, Matrix input)
{
if (matrix == null)
{
@@ -585,7 +582,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
throw new ArgumentNullException("input");
}
- var result = matrix.CreateMatrix(input.RowCount, input.ColumnCount);
+ var result = (Matrix)matrix.CreateMatrix(input.RowCount, input.ColumnCount);
Solve(matrix, input, result);
return result;
}
@@ -597,7 +594,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X
- public void Solve(Matrix matrix, Matrix input, Matrix result)
+ public void Solve(Matrix matrix, Matrix input, Matrix result)
{
if (matrix == null)
{
@@ -621,7 +618,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
for (var column = 0; column < input.ColumnCount; column++)
{
- var solution = Solve(matrix, input.Column(column));
+ var solution = Solve(matrix, (Vector)input.Column(column));
foreach (var element in solution.GetIndexedEnumerator())
{
result.At(element.Key, column, element.Value);
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/GpBiCg.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/GpBiCg.cs
index 26e35eb8..5451a75b 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/GpBiCg.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/GpBiCg.cs
@@ -31,9 +31,6 @@
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
{
using System;
- using Generic;
- using Generic.Solvers;
- using Generic.Solvers.Preconditioners;
using Generic.Solvers.Status;
using Numerics;
using Preconditioners;
@@ -66,7 +63,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// solver.
///
///
- public sealed class GpBiCg : IIterativeSolver
+ public sealed class GpBiCg : IIterativeSolver
{
///
/// The status used if there is no status, i.e. the solver hasn't run yet and there is no
@@ -78,12 +75,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The preconditioner that will be used. Can be set to null, in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ private IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ private IIterator _iterator;
///
/// Indicates the number of BiCGStab steps should be taken
@@ -106,7 +103,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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)
@@ -121,18 +118,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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) : this(null, iterator)
+ /// The that will be used to monitor the iterative process.
+ public GpBiCg(IIterator iterator) : this(null, iterator)
{
}
@@ -140,11 +137,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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.
- public GpBiCg(IPreConditioner preconditioner) : this(preconditioner, null)
+ /// The that will be used to precondition the matrix equation.
+ public GpBiCg(IPreConditioner preconditioner) : this(preconditioner, null)
{
}
@@ -153,19 +150,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
///
///
///
- /// 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 precondition the matrix equation.
+ /// The that will be used to monitor the iterative process.
+ public GpBiCg(IPreConditioner preconditioner, IIterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -216,19 +213,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Sets the that will be used to precondition the iterative process.
+ /// Sets the that will be used to precondition the iterative process.
///
/// The preconditioner.
- public void SetPreconditioner(IPreConditioner preconditioner)
+ public void SetPreconditioner(IPreConditioner preconditioner)
{
_preconditioner = preconditioner;
}
///
- /// 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(IIterator iterator)
{
_iterator = iterator;
}
@@ -263,14 +260,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b.
/// The result vector, x.
- public Vector Solve(Matrix matrix, Vector vector)
+ public Vector Solve(Matrix matrix, Vector vector)
{
if (vector == null)
{
throw new ArgumentNullException();
}
- Vector result = new DenseVector(matrix.RowCount);
+ Vector result = new DenseVector(matrix.RowCount);
Solve(matrix, vector, result);
return result;
}
@@ -282,7 +279,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b
/// The result vector, x
- public void Solve(Matrix matrix, Vector input, Vector result)
+ public void Solve(Matrix matrix, Vector input, Vector result)
{
// If we were stopped before, we are no longer
// We're doing this at the start of the method to ensure
@@ -336,11 +333,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
// x_0 is initial guess
// Take x_0 = 0
- Vector xtemp = new DenseVector(input.Count);
+ Vector xtemp = new DenseVector(input.Count);
// r_0 = b - Ax_0
// This is basically a SAXPY so it could be made a lot faster
- Vector residuals = new DenseVector(matrix.RowCount);
+ Vector residuals = new DenseVector(matrix.RowCount);
CalculateTrueResidual(matrix, residuals, xtemp, input);
// Define the temporary scalars
@@ -349,26 +346,26 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
// Define the temporary vectors
// rDash_0 = r_0
- Vector rdash = new DenseVector(residuals);
+ Vector rdash = new DenseVector(residuals);
// t_-1 = 0
- Vector t = new DenseVector(residuals.Count);
- Vector t0 = new DenseVector(residuals.Count);
+ Vector t = new DenseVector(residuals.Count);
+ Vector t0 = new DenseVector(residuals.Count);
// w_-1 = 0
- Vector w = new DenseVector(residuals.Count);
+ Vector w = new DenseVector(residuals.Count);
// Define the remaining temporary vectors
- Vector c = new DenseVector(residuals.Count);
- Vector p = new DenseVector(residuals.Count);
- Vector s = new DenseVector(residuals.Count);
- Vector u = new DenseVector(residuals.Count);
- Vector y = new DenseVector(residuals.Count);
- Vector z = new DenseVector(residuals.Count);
+ Vector c = new DenseVector(residuals.Count);
+ Vector p = new DenseVector(residuals.Count);
+ Vector s = new DenseVector(residuals.Count);
+ Vector u = new DenseVector(residuals.Count);
+ Vector y = new DenseVector(residuals.Count);
+ Vector z = new DenseVector(residuals.Count);
- Vector temp = new DenseVector(residuals.Count);
- Vector temp2 = new DenseVector(residuals.Count);
- Vector temp3 = new DenseVector(residuals.Count);
+ Vector temp = new DenseVector(residuals.Count);
+ Vector temp2 = new DenseVector(residuals.Count);
+ Vector temp3 = new DenseVector(residuals.Count);
// for (k = 0, 1, .... )
var iterationNumber = 0;
@@ -525,13 +522,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
+ /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
///
- /// Instance of the A.
- /// Residual values in .
- /// Instance of the x.
- /// Instance of the b.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ /// Instance of the A.
+ /// Residual values in .
+ /// Instance of the x.
+ /// Instance of the b.
+ private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
{
// -Ax = residual
matrix.Multiply(x, residual);
@@ -545,11 +542,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Determine if calculation should continue
///
/// Number of iterations passed
- /// Result .
- /// Source .
- /// Residual .
+ /// Result .
+ /// Source .
+ /// Residual .
/// true if continue, otherwise false
- private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
+ private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
if (_hasBeenStopped)
{
@@ -590,7 +587,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X.
- public Matrix Solve(Matrix matrix, Matrix input)
+ public Matrix Solve(Matrix matrix, Matrix input)
{
if (matrix == null)
{
@@ -602,7 +599,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
throw new ArgumentNullException("input");
}
- var result = matrix.CreateMatrix(input.RowCount, input.ColumnCount);
+ var result = (Matrix)matrix.CreateMatrix(input.RowCount, input.ColumnCount);
Solve(matrix, input, result);
return result;
}
@@ -614,7 +611,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X
- public void Solve(Matrix matrix, Matrix input, Matrix result)
+ public void Solve(Matrix matrix, Matrix input, Matrix result)
{
if (matrix == null)
{
@@ -638,7 +635,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
for (var column = 0; column < input.ColumnCount; column++)
{
- var solution = Solve(matrix, input.Column(column));
+ var solution = Solve(matrix, (Vector)input.Column(column));
foreach (var element in solution.GetIndexedEnumerator())
{
result.At(element.Key, column, element.Value);
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/MlkBiCgStab.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/MlkBiCgStab.cs
index 81ee45fb..ed1649e9 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/MlkBiCgStab.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/MlkBiCgStab.cs
@@ -35,10 +35,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
using System.Diagnostics;
using System.Linq;
using Distributions;
- using Generic;
using Generic.Factorization;
- using Generic.Solvers;
- using Generic.Solvers.Preconditioners;
using Generic.Solvers.Status;
using Numerics;
using Preconditioners;
@@ -67,7 +64,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// solver.
///
///
- public sealed class MlkBiCgStab : IIterativeSolver
+ public sealed class MlkBiCgStab : IIterativeSolver
{
///
/// The default number of starting vectors.
@@ -84,17 +81,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The preconditioner that will be used. Can be set to , in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ private IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ private IIterator _iterator;
///
/// The collection of starting vectors which are used as the basis for the Krylov sub-space.
///
- private IList> _startingVectors;
+ private IList _startingVectors;
///
/// The number of starting vectors used by the algorithm
@@ -110,7 +107,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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)
@@ -125,18 +122,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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) : this(null, iterator)
+ /// The that will be used to monitor the iterative process.
+ public MlkBiCgStab(IIterator iterator) : this(null, iterator)
{
}
@@ -144,11 +141,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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.
- public MlkBiCgStab(IPreConditioner preconditioner) : this(preconditioner, null)
+ /// The that will be used to precondition the matrix equation.
+ public MlkBiCgStab(IPreConditioner preconditioner) : this(preconditioner, null)
{
}
@@ -157,19 +154,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
///
///
///
- /// 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 precondition the matrix equation.
+ /// The that will be used to monitor the iterative process.
+ public MlkBiCgStab(IPreConditioner preconditioner, IIterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@@ -211,19 +208,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Sets the that will be used to precondition the iterative process.
+ /// Sets the that will be used to precondition the iterative process.
///
/// The preconditioner.
- public void SetPreconditioner(IPreConditioner preconditioner)
+ public void SetPreconditioner(IPreConditioner preconditioner)
{
_preconditioner = preconditioner;
}
///
- /// 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(IIterator iterator)
{
_iterator = iterator;
}
@@ -232,7 +229,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Gets or sets a series of orthonormal vectors which will be used as basis for the
/// Krylov sub-space.
///
- public IList> StartingVectors
+ public IList StartingVectors
{
[DebuggerStepThrough]
get
@@ -284,14 +281,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b.
/// The result vector, x.
- public Vector Solve(Matrix matrix, Vector vector)
+ public Vector Solve(Matrix matrix, Vector vector)
{
if (vector == null)
{
throw new ArgumentNullException();
}
- Vector result = new DenseVector(matrix.RowCount);
+ Vector result = new DenseVector(matrix.RowCount);
Solve(matrix, vector, result);
return result;
}
@@ -303,7 +300,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b
/// The result vector, x
- public void Solve(Matrix matrix, Vector input, Vector result)
+ public void Solve(Matrix matrix, Vector input, Vector result)
{
// If we were stopped before, we are no longer
// We're doing this at the start of the method to ensure
@@ -357,7 +354,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
// Choose an initial guess x_0
// Take x_0 = 0
- Vector xtemp = new DenseVector(input.Count);
+ Vector xtemp = new DenseVector(input.Count);
// Choose k vectors q_1, q_2, ..., q_k
// Build a new set if:
@@ -386,24 +383,24 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
// r_0 = b - Ax_0
// This is basically a SAXPY so it could be made a lot faster
- Vector residuals = new DenseVector(matrix.RowCount);
+ Vector residuals = new DenseVector(matrix.RowCount);
CalculateTrueResidual(matrix, residuals, xtemp, input);
// Define the temporary values
var c = new Complex32[k];
// Define the temporary vectors
- Vector gtemp = new DenseVector(residuals.Count);
+ Vector gtemp = new DenseVector(residuals.Count);
- Vector u = new DenseVector(residuals.Count);
- Vector utemp = new DenseVector(residuals.Count);
- Vector temp = new DenseVector(residuals.Count);
- Vector temp1 = new DenseVector(residuals.Count);
- Vector temp2 = new DenseVector(residuals.Count);
+ Vector u = new DenseVector(residuals.Count);
+ Vector utemp = new DenseVector(residuals.Count);
+ Vector temp = new DenseVector(residuals.Count);
+ Vector temp1 = new DenseVector(residuals.Count);
+ Vector temp2 = new DenseVector(residuals.Count);
- Vector zd = new DenseVector(residuals.Count);
- Vector zg = new DenseVector(residuals.Count);
- Vector zw = new DenseVector(residuals.Count);
+ Vector zd = new DenseVector(residuals.Count);
+ Vector zg = new DenseVector(residuals.Count);
+ Vector zw = new DenseVector(residuals.Count);
var d = CreateVectorArray(_startingVectors.Count, residuals.Count);
@@ -647,7 +644,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// the is smaller than
/// the .
///
- private static IList> CreateStartingVectors(int maximumNumberOfStartingVectors, int numberOfVariables)
+ private 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
@@ -658,7 +655,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
// mean = 0 and sd = 1
var distribution = new Normal();
- Matrix matrix = new DenseMatrix(numberOfVariables, count);
+ Matrix matrix = new DenseMatrix(numberOfVariables, count);
for (var i = 0; i < matrix.ColumnCount; i++)
{
var samples = new Complex32[matrix.RowCount];
@@ -678,10 +675,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
var orthogonalMatrix = gs.Q;
// Now transfer this to vectors
- var result = new List>();
+ var result = new List();
for (var i = 0; i < orthogonalMatrix.ColumnCount; i++)
{
- result.Add(orthogonalMatrix.Column(i));
+ result.Add((Vector)orthogonalMatrix.Column(i));
// Normalize the result vector
result[i].Multiply(1 / result[i].Norm(2).Real, result[i]);
@@ -691,14 +688,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Create random vecrors array
+ /// Create random vectors array
///
/// Number of vectors
/// Size of each vector
/// Array of random vectors
- private static Vector[] CreateVectorArray(int arraySize, int vectorSize)
+ private static Vector[] CreateVectorArray(int arraySize, int vectorSize)
{
- var result = new Vector[arraySize];
+ var result = new Vector[arraySize];
for (var i = 0; i < result.Length; i++)
{
result[i] = new DenseVector(vectorSize);
@@ -708,13 +705,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
+ /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
///
- /// Source A.
- /// Residual data.
- /// x data.
- /// b data.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ /// Source A.
+ /// Residual data.
+ /// x data.
+ /// b data.
+ private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
{
// -Ax = residual
matrix.Multiply(x, residual);
@@ -728,11 +725,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Determine if calculation should continue
///
/// Number of iterations passed
- /// Result .
- /// Source .
- /// Residual .
+ /// Result .
+ /// Source .
+ /// Residual .
/// true if continue, otherwise false
- private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
+ private bool ShouldContinue(int iterationNumber, Vector result, Vector source, Vector residuals)
{
if (_hasBeenStopped)
{
@@ -756,7 +753,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X.
- public Matrix Solve(Matrix matrix, Matrix input)
+ public Matrix Solve(Matrix matrix, Matrix input)
{
if (matrix == null)
{
@@ -768,7 +765,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
throw new ArgumentNullException("input");
}
- var result = matrix.CreateMatrix(input.RowCount, input.ColumnCount);
+ var result = (Matrix)matrix.CreateMatrix(input.RowCount, input.ColumnCount);
Solve(matrix, input, result);
return result;
}
@@ -780,7 +777,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution matrix, B.
/// The result matrix, X
- public void Solve(Matrix matrix, Matrix input, Matrix result)
+ public void Solve(Matrix matrix, Matrix input, Matrix result)
{
if (matrix == null)
{
@@ -804,7 +801,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
for (var column = 0; column < input.ColumnCount; column++)
{
- var solution = Solve(matrix, input.Column(column));
+ var solution = Solve(matrix, (Vector)input.Column(column));
foreach (var element in solution.GetIndexedEnumerator())
{
result.At(element.Key, column, element.Value);
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/TFQMR.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/TFQMR.cs
index 1a2ca2cf..06af4ffd 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/TFQMR.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/TFQMR.cs
@@ -31,9 +31,6 @@
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
{
using System;
- using Generic;
- using Generic.Solvers;
- using Generic.Solvers.Preconditioners;
using Generic.Solvers.Status;
using Numerics;
using Preconditioners;
@@ -56,7 +53,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// solver.
///
///
- public sealed class TFQMR : IIterativeSolver
+ public sealed class TFQMR : IIterativeSolver
{
///
/// The status used if there is no status, i.e. the solver hasn't run yet and there is no
@@ -68,12 +65,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The preconditioner that will be used. Can be set to , in which case the default
/// pre-conditioner will be used.
///
- private IPreConditioner _preconditioner;
+ private IPreConditioner _preconditioner;
///
/// The iterative process controller.
///
- private IIterator _iterator;
+ private IIterator _iterator;
///
/// Indicates if the user has stopped the solver.
@@ -84,7 +81,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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)
@@ -99,18 +96,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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) : this(null, iterator)
+ /// The that will be used to monitor the iterative process.
+ public TFQMR(IIterator iterator) : this(null, iterator)
{
}
@@ -118,11 +115,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// 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.
- public TFQMR(IPreConditioner preconditioner) : this(preconditioner, null)
+ /// The that will be used to precondition the matrix equation.
+ public TFQMR(IPreConditioner preconditioner) : this(preconditioner, null)
{
}
@@ -131,38 +128,38 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
///
///
///
- /// 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 precondition the matrix equation.
+ /// The that will be used to monitor the iterative process.
+ public TFQMR(IPreConditioner preconditioner, IIterator iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
}
///
- /// Sets the that will be used to precondition the iterative process.
+ /// Sets the that will be used to precondition the iterative process.
///
/// The preconditioner.
- public void SetPreconditioner(IPreConditioner preconditioner)
+ public void SetPreconditioner(IPreConditioner preconditioner)
{
_preconditioner = preconditioner;
}
///
- /// 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(IIterator iterator)
{
_iterator = iterator;
}
@@ -196,14 +193,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b.
/// The result vector, x.
- public Vector Solve(Matrix matrix, Vector vector)
+ public Vector Solve(Matrix matrix, Vector vector)
{
if (vector == null)
{
throw new ArgumentNullException();
}
- Vector result = new DenseVector(matrix.RowCount);
+ Vector result = new DenseVector(matrix.RowCount);
Solve(matrix, vector, result);
return result;
}
@@ -215,7 +212,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// The coefficient matrix, A.
/// The solution vector, b
/// The result vector, x
- public void Solve(Matrix matrix, Vector input, Vector result)
+ public void Solve(Matrix matrix, Vector input, Vector result)
{
// If we were stopped before, we are no longer
// We're doing this at the start of the method to ensure
@@ -427,13 +424,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
}
///
- /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
+ /// Calculates the true residual of the matrix equation Ax = b according to: residual = b - Ax
///
- /// Instance of the A.
- /// Residual values in .
- /// Instance of the x.
- /// Instance of the b.
- private static void CalculateTrueResidual(Matrix matrix, Vector residual, Vector x, Vector b)
+ ///