Browse Source

LA: make IIterator generic & shared

optimization-1
Christoph Ruegg 13 years ago
parent
commit
4002517b05
  1. 3
      src/Numerics/LinearAlgebra/Complex/Solvers/IIterativeSolver.cs
  2. 110
      src/Numerics/LinearAlgebra/Complex/Solvers/IIterator.cs
  3. 11
      src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/BiCgStab.cs
  4. 11
      src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/CompositeSolver.cs
  5. 11
      src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/GpBiCg.cs
  6. 9
      src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/MlkBiCgStab.cs
  7. 11
      src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/TFQMR.cs
  8. 7
      src/Numerics/LinearAlgebra/Complex/Solvers/Iterator.cs
  9. 3
      src/Numerics/LinearAlgebra/Complex32/Solvers/IIterativeSolver.cs
  10. 105
      src/Numerics/LinearAlgebra/Complex32/Solvers/IIterator.cs
  11. 11
      src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/BiCgStab.cs
  12. 11
      src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/CompositeSolver.cs
  13. 11
      src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/GpBiCg.cs
  14. 9
      src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/MlkBiCgStab.cs
  15. 11
      src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/TFQMR.cs
  16. 7
      src/Numerics/LinearAlgebra/Complex32/Solvers/Iterator.cs
  17. 3
      src/Numerics/LinearAlgebra/Double/Solvers/IIterativeSolver.cs
  18. 12
      src/Numerics/LinearAlgebra/Double/Solvers/Iterative/BiCgStab.cs
  19. 11
      src/Numerics/LinearAlgebra/Double/Solvers/Iterative/CompositeSolver.cs
  20. 12
      src/Numerics/LinearAlgebra/Double/Solvers/Iterative/GpBiCg.cs
  21. 10
      src/Numerics/LinearAlgebra/Double/Solvers/Iterative/MlkBiCgStab.cs
  22. 12
      src/Numerics/LinearAlgebra/Double/Solvers/Iterative/TFQMR.cs
  23. 7
      src/Numerics/LinearAlgebra/Double/Solvers/Iterator.cs
  24. 3
      src/Numerics/LinearAlgebra/Single/Solvers/IIterativeSolver.cs
  25. 103
      src/Numerics/LinearAlgebra/Single/Solvers/IIterator.cs
  26. 12
      src/Numerics/LinearAlgebra/Single/Solvers/Iterative/BiCgStab.cs
  27. 11
      src/Numerics/LinearAlgebra/Single/Solvers/Iterative/CompositeSolver.cs
  28. 11
      src/Numerics/LinearAlgebra/Single/Solvers/Iterative/GpBiCg.cs
  29. 10
      src/Numerics/LinearAlgebra/Single/Solvers/Iterative/MlkBiCgStab.cs
  30. 11
      src/Numerics/LinearAlgebra/Single/Solvers/Iterative/TFQMR.cs
  31. 7
      src/Numerics/LinearAlgebra/Single/Solvers/Iterator.cs
  32. 28
      src/Numerics/LinearAlgebra/Solvers/IIterator.cs
  33. 5
      src/Numerics/Numerics.csproj

3
src/Numerics/LinearAlgebra/Complex/Solvers/IIterativeSolver.cs

@ -28,6 +28,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
@ -57,7 +58,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
void SetIterator(IIterator iterator);
void SetIterator(IIterator<Complex> iterator);
/// <summary>
/// Gets the status of the iteration once the calculation is finished.

110
src/Numerics/LinearAlgebra/Complex/Solvers/IIterator.cs

@ -1,110 +0,0 @@
// <copyright file="IIterator.cs" company="Math.NET">
// 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.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.LinearAlgebra.Solvers.StopCriterium;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
#if NOSYSNUMERICS
using Complex = Numerics.Complex;
#else
using Complex = System.Numerics.Complex;
#endif
/// <summary>
/// Defines the base interface for iterators that help control an iterative calculation.
/// </summary>
public interface IIterator
{
/// <summary>
/// Adds an <see cref="IIterationStopCriterium{T}"/> to the internal collection of stop-criteria. Only a
/// single stop criterium of each type can be stored.
/// </summary>
/// <param name="stopCriterium">The stop criterium to add.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="stopCriterium"/> is <see langword="null" />.</exception>
/// <exception cref="ArgumentException">Thrown if <paramref name="stopCriterium"/> is of the same type as an already stored criterium.</exception>
void Add(IIterationStopCriterium<Complex> stopCriterium);
/// <summary>
/// Removes the <see cref="IIterationStopCriterium{T}"/> from the internal collection.
/// </summary>
/// <param name="stopCriterium">The stop criterium that must be removed.</param>
void Remove(IIterationStopCriterium<Complex> stopCriterium);
/// <summary>
/// Indicates if the specific stop criterium is stored by the <see cref="IIterator"/>.
/// </summary>
/// <param name="stopCriterium">The stop criterium.</param>
/// <returns><c>true</c> if the <see cref="IIterator"/> contains the stop criterium; otherwise <c>false</c>.</returns>
bool Contains(IIterationStopCriterium<Complex> stopCriterium);
/// <summary>
/// Indicates to the iterator that the iterative process has been cancelled.
/// </summary>
/// <remarks>Does not reset the stop-criteria.</remarks>
void IterationCancelled();
/// <summary>
/// Determines the status of the iterative calculation based on the stop criteria stored
/// by the current <see cref="IIterator"/>. Status is set to <c>Status</c> field of current object.
/// </summary>
/// <param name="iterationNumber">The number of iterations that have passed so far.</param>
/// <param name="solutionVector">The vector containing the current solution values.</param>
/// <param name="sourceVector">The right hand side vector.</param>
/// <param name="residualVector">The vector containing the current residual vectors.</param>
/// <remarks>
/// 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.
/// </remarks>
void DetermineStatus(int iterationNumber, Vector<Complex> solutionVector, Vector<Complex> sourceVector, Vector<Complex> residualVector);
/// <summary>
/// Gets the current calculation status.
/// </summary>
/// <remarks><see langword="null" /> is not a legal value. Status should be set in <see cref="DetermineStatus"/> implementation.</remarks>.
ICalculationStatus Status { get; }
/// <summary>
/// Resets the <see cref="IIterator"/> to the pre-calculation state.
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
void ResetToPrecalculationState();
IIterator Clone();
}
}

11
src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/BiCgStab.cs

@ -28,9 +28,10 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using System;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
@ -89,7 +90,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
IIterator _iterator;
IIterator<Complex> _iterator;
/// <summary>
/// Indicates if the user has stopped the solver.
@ -127,7 +128,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process. </param>
public BiCgStab(IIterator iterator)
public BiCgStab(IIterator<Complex> iterator)
: this(null, iterator)
{
}
@ -162,7 +163,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation. </param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process. </param>
public BiCgStab(IPreConditioner preconditioner, IIterator iterator)
public BiCgStab(IPreConditioner preconditioner, IIterator<Complex> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -181,7 +182,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<Complex> iterator)
{
_iterator = iterator;
}

11
src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/CompositeSolver.cs

@ -28,13 +28,14 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
{
@ -349,7 +350,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// <summary>
/// The iterator that is used to control the iteration process.
/// </summary>
private IIterator _iterator;
private IIterator<Complex> _iterator;
/// <summary>
/// A flag indicating if the solver has been stopped or not.
@ -373,7 +374,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Initializes a new instance of the <see cref="CompositeSolver"/> class with the specified iterator.
/// </summary>
/// <param name="iterator">The iterator that will be used to control the iteration process. </param>
public CompositeSolver(IIterator iterator)
public CompositeSolver(IIterator<Complex> iterator)
{
_iterator = iterator;
}
@ -382,7 +383,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Sets the <c>IIterator</c> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<Complex> iterator)
{
_iterator = iterator;
}

11
src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/GpBiCg.cs

@ -28,10 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
{
@ -87,7 +88,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
IIterator _iterator;
IIterator<Complex> _iterator;
/// <summary>
/// Indicates the number of <c>BiCGStab</c> steps should be taken
@ -137,7 +138,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public GpBiCg(IIterator iterator)
public GpBiCg(IIterator<Complex> iterator)
: this(null, iterator)
{
}
@ -172,7 +173,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public GpBiCg(IPreConditioner preconditioner, IIterator iterator)
public GpBiCg(IPreConditioner preconditioner, IIterator<Complex> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -229,7 +230,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<Complex> iterator)
{
_iterator = iterator;
}

9
src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/MlkBiCgStab.cs

@ -34,6 +34,7 @@ using System.Diagnostics;
using System.Linq;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
@ -92,7 +93,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
IIterator _iterator;
IIterator<Complex> _iterator;
/// <summary>
/// The collection of starting vectors which are used as the basis for the Krylov sub-space.
@ -140,7 +141,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public MlkBiCgStab(IIterator iterator)
public MlkBiCgStab(IIterator<Complex> iterator)
: this(null, iterator)
{
}
@ -175,7 +176,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public MlkBiCgStab(IPreConditioner preconditioner, IIterator iterator)
public MlkBiCgStab(IPreConditioner preconditioner, IIterator<Complex> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -226,7 +227,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<Complex> iterator)
{
_iterator = iterator;
}

11
src/Numerics/LinearAlgebra/Complex/Solvers/Iterative/TFQMR.cs

@ -28,10 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
{
@ -77,7 +78,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
IIterator _iterator;
IIterator<Complex> _iterator;
/// <summary>
/// Indicates if the user has stopped the solver.
@ -115,7 +116,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public TFQMR(IIterator iterator)
public TFQMR(IIterator<Complex> iterator)
: this(null, iterator)
{
}
@ -150,7 +151,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public TFQMR(IPreConditioner preconditioner, IIterator iterator)
public TFQMR(IPreConditioner preconditioner, IIterator<Complex> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -169,7 +170,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<Complex> iterator)
{
_iterator = iterator;
}

7
src/Numerics/LinearAlgebra/Complex/Solvers/Iterator.cs

@ -32,6 +32,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.LinearAlgebra.Solvers.StopCriterium;
using MathNet.Numerics.Properties;
@ -48,7 +49,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// <summary>
/// An iterator that is used to check if an iterative calculation should continue or stop.
/// </summary>
public sealed class Iterator : IIterator
public sealed class Iterator : IIterator<Complex>
{
/// <summary>
/// The default status for the iterator.
@ -59,7 +60,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Creates a default iterator with all the <see cref="IIterationStopCriterium{T}"/> objects.
/// </summary>
/// <returns>A new <see cref="IIterator"/> object.</returns>
public static IIterator CreateDefault()
public static IIterator<Complex> CreateDefault()
{
var iterator = new Iterator();
iterator.Add(new FailureStopCriterium());
@ -313,7 +314,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Creates a deep clone of the current iterator.
/// </summary>
/// <returns>The deep clone of the current iterator.</returns>
public IIterator Clone()
public IIterator<Complex> Clone()
{
var stopCriteria = _stopCriterias.Select(pair => pair.Value).Select(stopCriterium => stopCriterium.Clone()).ToList();
return new Iterator(stopCriteria);

3
src/Numerics/LinearAlgebra/Complex32/Solvers/IIterativeSolver.cs

@ -28,6 +28,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
@ -52,7 +53,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
void SetIterator(IIterator iterator);
void SetIterator(IIterator<Complex32> iterator);
/// <summary>
/// Gets the status of the iteration once the calculation is finished.

105
src/Numerics/LinearAlgebra/Complex32/Solvers/IIterator.cs

@ -1,105 +0,0 @@
// <copyright file="IIterator.cs" company="Math.NET">
// 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.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.LinearAlgebra.Solvers.StopCriterium;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
using Numerics;
/// <summary>
/// Defines the base interface for iterators that help control an iterative calculation.
/// </summary>
public interface IIterator
{
/// <summary>
/// Adds an <see cref="IIterationStopCriterium{T}"/> to the internal collection of stop-criteria. Only a
/// single stop criterium of each type can be stored.
/// </summary>
/// <param name="stopCriterium">The stop criterium to add.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="stopCriterium"/> is <see langword="null" />.</exception>
/// <exception cref="ArgumentException">Thrown if <paramref name="stopCriterium"/> is of the same type as an already stored criterium.</exception>
void Add(IIterationStopCriterium<Complex32> stopCriterium);
/// <summary>
/// Removes the <see cref="IIterationStopCriterium{T}"/> from the internal collection.
/// </summary>
/// <param name="stopCriterium">The stop criterium that must be removed.</param>
void Remove(IIterationStopCriterium<Complex32> stopCriterium);
/// <summary>
/// Indicates if the specific stop criterium is stored by the <see cref="IIterator"/>.
/// </summary>
/// <param name="stopCriterium">The stop criterium.</param>
/// <returns><c>true</c> if the <see cref="IIterator"/> contains the stop criterium; otherwise <c>false</c>.</returns>
bool Contains(IIterationStopCriterium<Complex32> stopCriterium);
/// <summary>
/// Indicates to the iterator that the iterative process has been cancelled.
/// </summary>
/// <remarks>Does not reset the stop-criteria.</remarks>
void IterationCancelled();
/// <summary>
/// Determines the status of the iterative calculation based on the stop criteria stored
/// by the current <see cref="IIterator"/>. Status is set to <c>Status</c> field of current object.
/// </summary>
/// <param name="iterationNumber">The number of iterations that have passed so far.</param>
/// <param name="solutionVector">The vector containing the current solution values.</param>
/// <param name="sourceVector">The right hand side vector.</param>
/// <param name="residualVector">The vector containing the current residual vectors.</param>
/// <remarks>
/// 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.
/// </remarks>
void DetermineStatus(int iterationNumber, Vector<Complex32> solutionVector, Vector<Complex32> sourceVector, Vector<Complex32> residualVector);
/// <summary>
/// Gets the current calculation status.
/// </summary>
/// <remarks><see langword="null" /> is not a legal value. Status should be set in <see cref="DetermineStatus"/> implementation.</remarks>.
ICalculationStatus Status { get; }
/// <summary>
/// Resets the <see cref="IIterator"/> to the pre-calculation state.
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
void ResetToPrecalculationState();
IIterator Clone();
}
}

11
src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/BiCgStab.cs

@ -28,10 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
{
@ -83,7 +84,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
IIterator _iterator;
IIterator<Complex32> _iterator;
/// <summary>
/// Indicates if the user has stopped the solver.
@ -121,7 +122,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process. </param>
public BiCgStab(IIterator iterator)
public BiCgStab(IIterator<Complex32> iterator)
: this(null, iterator)
{
}
@ -156,7 +157,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation. </param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process. </param>
public BiCgStab(IPreConditioner preconditioner, IIterator iterator)
public BiCgStab(IPreConditioner preconditioner, IIterator<Complex32> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -175,7 +176,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<Complex32> iterator)
{
_iterator = iterator;
}

11
src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/CompositeSolver.cs

@ -28,13 +28,14 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
{
@ -344,7 +345,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// <summary>
/// The iterator that is used to control the iteration process.
/// </summary>
private IIterator _iterator;
private IIterator<Complex32> _iterator;
/// <summary>
/// A flag indicating if the solver has been stopped or not.
@ -368,7 +369,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Initializes a new instance of the <see cref="CompositeSolver"/> class with the specified iterator.
/// </summary>
/// <param name="iterator">The iterator that will be used to control the iteration process. </param>
public CompositeSolver(IIterator iterator)
public CompositeSolver(IIterator<Complex32> iterator)
{
_iterator = iterator;
}
@ -377,7 +378,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Sets the <c>IIterator</c> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<Complex32> iterator)
{
_iterator = iterator;
}

11
src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/GpBiCg.cs

@ -28,10 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
{
@ -81,7 +82,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
IIterator _iterator;
IIterator<Complex32> _iterator;
/// <summary>
/// Indicates the number of <c>BiCGStab</c> steps should be taken
@ -131,7 +132,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public GpBiCg(IIterator iterator)
public GpBiCg(IIterator<Complex32> iterator)
: this(null, iterator)
{
}
@ -166,7 +167,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public GpBiCg(IPreConditioner preconditioner, IIterator iterator)
public GpBiCg(IPreConditioner preconditioner, IIterator<Complex32> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -223,7 +224,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<Complex32> iterator)
{
_iterator = iterator;
}

9
src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/MlkBiCgStab.cs

@ -34,6 +34,7 @@ using System.Diagnostics;
using System.Linq;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
@ -86,7 +87,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
IIterator _iterator;
IIterator<Complex32> _iterator;
/// <summary>
/// The collection of starting vectors which are used as the basis for the Krylov sub-space.
@ -134,7 +135,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public MlkBiCgStab(IIterator iterator)
public MlkBiCgStab(IIterator<Complex32> iterator)
: this(null, iterator)
{
}
@ -169,7 +170,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public MlkBiCgStab(IPreConditioner preconditioner, IIterator iterator)
public MlkBiCgStab(IPreConditioner preconditioner, IIterator<Complex32> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -220,7 +221,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<Complex32> iterator)
{
_iterator = iterator;
}

11
src/Numerics/LinearAlgebra/Complex32/Solvers/Iterative/TFQMR.cs

@ -28,10 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
{
@ -71,7 +72,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
IIterator _iterator;
IIterator<Complex32> _iterator;
/// <summary>
/// Indicates if the user has stopped the solver.
@ -109,7 +110,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public TFQMR(IIterator iterator)
public TFQMR(IIterator<Complex32> iterator)
: this(null, iterator)
{
}
@ -144,7 +145,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public TFQMR(IPreConditioner preconditioner, IIterator iterator)
public TFQMR(IPreConditioner preconditioner, IIterator<Complex32> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -163,7 +164,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<Complex32> iterator)
{
_iterator = iterator;
}

7
src/Numerics/LinearAlgebra/Complex32/Solvers/Iterator.cs

@ -32,6 +32,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.LinearAlgebra.Solvers.StopCriterium;
using MathNet.Numerics.Properties;
@ -43,7 +44,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// <summary>
/// An iterator that is used to check if an iterative calculation should continue or stop.
/// </summary>
public sealed class Iterator : IIterator
public sealed class Iterator : IIterator<Complex32>
{
/// <summary>
/// The default status for the iterator.
@ -54,7 +55,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Creates a default iterator with all the <see cref="IIterationStopCriterium"/> objects.
/// </summary>
/// <returns>A new <see cref="IIterator"/> object.</returns>
public static IIterator CreateDefault()
public static IIterator<Complex32> CreateDefault()
{
var iterator = new Iterator();
iterator.Add(new FailureStopCriterium());
@ -308,7 +309,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Creates a deep clone of the current iterator.
/// </summary>
/// <returns>The deep clone of the current iterator.</returns>
public IIterator Clone()
public IIterator<Complex32> Clone()
{
var stopCriteria = _stopCriterias.Select(pair => pair.Value).Select(stopCriterium => stopCriterium.Clone()).ToList();
return new Iterator(stopCriteria);

3
src/Numerics/LinearAlgebra/Double/Solvers/IIterativeSolver.cs

@ -28,6 +28,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
@ -50,7 +51,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
void SetIterator(IIterator iterator);
void SetIterator(IIterator<double> iterator);
/// <summary>
/// Gets the status of the iteration once the calculation is finished.

12
src/Numerics/LinearAlgebra/Double/Solvers/Iterative/BiCgStab.cs

@ -28,10 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
{
@ -81,7 +82,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
private IIterator _iterator;
private IIterator<double> _iterator;
/// <summary>
/// Indicates if the user has stopped the solver.
@ -118,7 +119,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process. </param>
public BiCgStab(IIterator iterator) : this(null, iterator)
public BiCgStab(IIterator<double> iterator)
: this(null, iterator)
{
}
@ -151,7 +153,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation. </param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process. </param>
public BiCgStab(IPreConditioner preconditioner, IIterator iterator)
public BiCgStab(IPreConditioner preconditioner, IIterator<double> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -170,7 +172,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<double> iterator)
{
_iterator = iterator;
}

11
src/Numerics/LinearAlgebra/Double/Solvers/Iterative/CompositeSolver.cs

@ -28,13 +28,14 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
{
@ -339,7 +340,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// <summary>
/// The iterator that is used to control the iteration process.
/// </summary>
private IIterator _iterator;
private IIterator<double> _iterator;
/// <summary>
/// A flag indicating if the solver has been stopped or not.
@ -363,7 +364,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// Initializes a new instance of the <see cref="CompositeSolver"/> class with the specified iterator.
/// </summary>
/// <param name="iterator">The iterator that will be used to control the iteration process. </param>
public CompositeSolver(IIterator iterator)
public CompositeSolver(IIterator<double> iterator)
{
_iterator = iterator;
}
@ -372,7 +373,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<double> iterator)
{
_iterator = iterator;
}

12
src/Numerics/LinearAlgebra/Double/Solvers/Iterative/GpBiCg.cs

@ -28,10 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
{
@ -79,7 +80,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
private IIterator _iterator;
private IIterator<double> _iterator;
/// <summary>
/// Indicates the number of <c>BiCGStab</c> steps should be taken
@ -128,7 +129,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public GpBiCg(IIterator iterator) : this(null, iterator)
public GpBiCg(IIterator<double> iterator)
: this(null, iterator)
{
}
@ -161,7 +163,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public GpBiCg(IPreConditioner preconditioner, IIterator iterator)
public GpBiCg(IPreConditioner preconditioner, IIterator<double> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -224,7 +226,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<double> iterator)
{
_iterator = iterator;
}

10
src/Numerics/LinearAlgebra/Double/Solvers/Iterative/MlkBiCgStab.cs

@ -34,6 +34,7 @@ using System.Diagnostics;
using System.Linq;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
@ -84,7 +85,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
private IIterator _iterator;
private IIterator<double> _iterator;
/// <summary>
/// The collection of starting vectors which are used as the basis for the Krylov sub-space.
@ -131,7 +132,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public MlkBiCgStab(IIterator iterator) : this(null, iterator)
public MlkBiCgStab(IIterator<double> iterator)
: this(null, iterator)
{
}
@ -164,7 +166,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public MlkBiCgStab(IPreConditioner preconditioner, IIterator iterator)
public MlkBiCgStab(IPreConditioner preconditioner, IIterator<double> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -218,7 +220,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<double> iterator)
{
_iterator = iterator;
}

12
src/Numerics/LinearAlgebra/Double/Solvers/Iterative/TFQMR.cs

@ -28,10 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
{
@ -69,7 +70,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
private IIterator _iterator;
private IIterator<double> _iterator;
/// <summary>
/// Indicates if the user has stopped the solver.
@ -106,7 +107,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public TFQMR(IIterator iterator) : this(null, iterator)
public TFQMR(IIterator<double> iterator)
: this(null, iterator)
{
}
@ -139,7 +141,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public TFQMR(IPreConditioner preconditioner, IIterator iterator)
public TFQMR(IPreConditioner preconditioner, IIterator<double> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -158,7 +160,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<double> iterator)
{
_iterator = iterator;
}

7
src/Numerics/LinearAlgebra/Double/Solvers/Iterator.cs

@ -32,6 +32,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.LinearAlgebra.Solvers.StopCriterium;
using MathNet.Numerics.Properties;
@ -41,7 +42,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// <summary>
/// An iterator that is used to check if an iterative calculation should continue or stop.
/// </summary>
public sealed class Iterator : IIterator
public sealed class Iterator : IIterator<double>
{
/// <summary>
/// The default status for the iterator.
@ -52,7 +53,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Creates a default iterator with all the <see cref="IIterationStopCriterium{T}"/> objects.
/// </summary>
/// <returns>A new <see cref="IIterator"/> object.</returns>
public static IIterator CreateDefault()
public static IIterator<double> CreateDefault()
{
var iterator = new Iterator();
iterator.Add(new FailureStopCriterium());
@ -306,7 +307,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Creates a deep clone of the current iterator.
/// </summary>
/// <returns>The deep clone of the current iterator.</returns>
public IIterator Clone()
public IIterator<double> Clone()
{
var stopCriteria = _stopCriterias.Select(pair => pair.Value).Select(stopCriterium => stopCriterium.Clone()).ToList();
return new Iterator(stopCriteria);

3
src/Numerics/LinearAlgebra/Single/Solvers/IIterativeSolver.cs

@ -28,6 +28,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
@ -50,7 +51,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
void SetIterator(IIterator iterator);
void SetIterator(IIterator<float> iterator);
/// <summary>
/// Gets the status of the iteration once the calculation is finished.

103
src/Numerics/LinearAlgebra/Single/Solvers/IIterator.cs

@ -1,103 +0,0 @@
// <copyright file="IIterator.cs" company="Math.NET">
// 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.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.LinearAlgebra.Solvers.StopCriterium;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
/// <summary>
/// Defines the base interface for iterators that help control an iterative calculation.
/// </summary>
public interface IIterator
{
/// <summary>
/// Adds an <see cref="IIterationStopCriterium{T}"/> to the internal collection of stop-criteria. Only a
/// single stop criterium of each type can be stored.
/// </summary>
/// <param name="stopCriterium">The stop criterium to add.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="stopCriterium"/> is <see langword="null" />.</exception>
/// <exception cref="ArgumentException">Thrown if <paramref name="stopCriterium"/> is of the same type as an already stored criterium.</exception>
void Add(IIterationStopCriterium<float> stopCriterium);
/// <summary>
/// Removes the <see cref="IIterationStopCriterium{T}"/> from the internal collection.
/// </summary>
/// <param name="stopCriterium">The stop criterium that must be removed.</param>
void Remove(IIterationStopCriterium<float> stopCriterium);
/// <summary>
/// Indicates if the specific stop criterium is stored by the <see cref="IIterator"/>.
/// </summary>
/// <param name="stopCriterium">The stop criterium.</param>
/// <returns><c>true</c> if the <see cref="IIterator"/> contains the stop criterium; otherwise <c>false</c>.</returns>
bool Contains(IIterationStopCriterium<float> stopCriterium);
/// <summary>
/// Indicates to the iterator that the iterative process has been cancelled.
/// </summary>
/// <remarks>Does not reset the stop-criteria.</remarks>
void IterationCancelled();
/// <summary>
/// Determines the status of the iterative calculation based on the stop criteria stored
/// by the current <see cref="IIterator"/>. Status is set to <c>Status</c> field of current object.
/// </summary>
/// <param name="iterationNumber">The number of iterations that have passed so far.</param>
/// <param name="solutionVector">The vector containing the current solution values.</param>
/// <param name="sourceVector">The right hand side vector.</param>
/// <param name="residualVector">The vector containing the current residual vectors.</param>
/// <remarks>
/// 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.
/// </remarks>
void DetermineStatus(int iterationNumber, Vector<float> solutionVector, Vector<float> sourceVector, Vector<float> residualVector);
/// <summary>
/// Gets the current calculation status.
/// </summary>
/// <remarks><see langword="null" /> is not a legal value. Status should be set in <see cref="DetermineStatus"/> implementation.</remarks>.
ICalculationStatus Status { get; }
/// <summary>
/// Resets the <see cref="IIterator"/> to the pre-calculation state.
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
void ResetToPrecalculationState();
IIterator Clone();
}
}

12
src/Numerics/LinearAlgebra/Single/Solvers/Iterative/BiCgStab.cs

@ -28,10 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
{
@ -81,7 +82,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
private IIterator _iterator;
private IIterator<float> _iterator;
/// <summary>
/// Indicates if the user has stopped the solver.
@ -118,7 +119,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process. </param>
public BiCgStab(IIterator iterator) : this(null, iterator)
public BiCgStab(IIterator<float> iterator)
: this(null, iterator)
{
}
@ -151,7 +153,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation. </param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process. </param>
public BiCgStab(IPreConditioner preconditioner, IIterator iterator)
public BiCgStab(IPreConditioner preconditioner, IIterator<float> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -170,7 +172,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<float> iterator)
{
_iterator = iterator;
}

11
src/Numerics/LinearAlgebra/Single/Solvers/Iterative/CompositeSolver.cs

@ -28,13 +28,14 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
{
@ -342,7 +343,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// <summary>
/// The iterator that is used to control the iteration process.
/// </summary>
private IIterator _iterator;
private IIterator<float> _iterator;
/// <summary>
/// A flag indicating if the solver has been stopped or not.
@ -366,7 +367,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// Initializes a new instance of the <see cref="CompositeSolver"/> class with the specified iterator.
/// </summary>
/// <param name="iterator">The iterator that will be used to control the iteration process. </param>
public CompositeSolver(IIterator iterator)
public CompositeSolver(IIterator<float> iterator)
{
_iterator = iterator;
}
@ -375,7 +376,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<float> iterator)
{
_iterator = iterator;
}

11
src/Numerics/LinearAlgebra/Single/Solvers/Iterative/GpBiCg.cs

@ -28,10 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
{
@ -79,7 +80,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
IIterator _iterator;
IIterator<float> _iterator;
/// <summary>
/// Indicates the number of <c>BiCGStab</c> steps should be taken
@ -129,7 +130,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public GpBiCg(IIterator iterator)
public GpBiCg(IIterator<float> iterator)
: this(null, iterator)
{
}
@ -164,7 +165,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public GpBiCg(IPreConditioner preconditioner, IIterator iterator)
public GpBiCg(IPreConditioner preconditioner, IIterator<float> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -221,7 +222,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<float> iterator)
{
_iterator = iterator;
}

10
src/Numerics/LinearAlgebra/Single/Solvers/Iterative/MlkBiCgStab.cs

@ -33,6 +33,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
@ -83,7 +84,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
private IIterator _iterator;
private IIterator<float> _iterator;
/// <summary>
/// The collection of starting vectors which are used as the basis for the Krylov sub-space.
@ -130,7 +131,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public MlkBiCgStab(IIterator iterator) : this(null, iterator)
public MlkBiCgStab(IIterator<float> iterator)
: this(null, iterator)
{
}
@ -163,7 +165,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public MlkBiCgStab(IPreConditioner preconditioner, IIterator iterator)
public MlkBiCgStab(IPreConditioner preconditioner, IIterator<float> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -217,7 +219,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<float> iterator)
{
_iterator = iterator;
}

11
src/Numerics/LinearAlgebra/Single/Solvers/Iterative/TFQMR.cs

@ -28,10 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.Properties;
using System;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
{
@ -69,7 +70,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// <summary>
/// The iterative process controller.
/// </summary>
IIterator _iterator;
IIterator<float> _iterator;
/// <summary>
/// Indicates if the user has stopped the solver.
@ -107,7 +108,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// </para>
/// </remarks>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public TFQMR(IIterator iterator)
public TFQMR(IIterator<float> iterator)
: this(null, iterator)
{
}
@ -142,7 +143,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// </remarks>
/// <param name="preconditioner">The <see cref="IPreConditioner"/> that will be used to precondition the matrix equation.</param>
/// <param name="iterator">The <see cref="IIterator"/> that will be used to monitor the iterative process.</param>
public TFQMR(IPreConditioner preconditioner, IIterator iterator)
public TFQMR(IPreConditioner preconditioner, IIterator<float> iterator)
{
_iterator = iterator;
_preconditioner = preconditioner;
@ -161,7 +162,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Iterative
/// Sets the <see cref="IIterator"/> that will be used to track the iterative process.
/// </summary>
/// <param name="iterator">The iterator.</param>
public void SetIterator(IIterator iterator)
public void SetIterator(IIterator<float> iterator)
{
_iterator = iterator;
}

7
src/Numerics/LinearAlgebra/Single/Solvers/Iterator.cs

@ -32,6 +32,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.LinearAlgebra.Solvers.StopCriterium;
using MathNet.Numerics.Properties;
@ -41,7 +42,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
/// <summary>
/// An iterator that is used to check if an iterative calculation should continue or stop.
/// </summary>
public sealed class Iterator : IIterator
public sealed class Iterator : IIterator<float>
{
/// <summary>
/// The default status for the iterator.
@ -52,7 +53,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
/// Creates a default iterator with all the <see cref="IIterationStopCriterium{T}"/> objects.
/// </summary>
/// <returns>A new <see cref="IIterator"/> object.</returns>
public static IIterator CreateDefault()
public static IIterator<float> CreateDefault()
{
var iterator = new Iterator();
iterator.Add(new FailureStopCriterium());
@ -306,7 +307,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
/// Creates a deep clone of the current iterator.
/// </summary>
/// <returns>The deep clone of the current iterator.</returns>
public IIterator Clone()
public IIterator<float> Clone()
{
var stopCriteria = _stopCriterias.Select(pair => pair.Value).Select(stopCriterium => stopCriterium.Clone()).ToList();
return new Iterator(stopCriteria);

28
src/Numerics/LinearAlgebra/Double/Solvers/IIterator.cs → src/Numerics/LinearAlgebra/Solvers/IIterator.cs

@ -4,7 +4,7 @@
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009-2010 Math.NET
// Copyright (c) 2009-2013 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -28,16 +28,16 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.LinearAlgebra.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using System;
using MathNet.Numerics.LinearAlgebra.Solvers.Status;
using MathNet.Numerics.LinearAlgebra.Solvers.StopCriterium;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
namespace MathNet.Numerics.LinearAlgebra.Solvers
{
/// <summary>
/// Defines the base interface for iterators that help control an iterative calculation.
/// </summary>
public interface IIterator
public interface IIterator<T> where T : struct, IEquatable<T>, IFormattable
{
/// <summary>
/// Adds an <see cref="IIterationStopCriterium{T}"/> to the internal collection of stop-criteria. Only a
@ -46,20 +46,20 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// <param name="stopCriterium">The stop criterium to add.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="stopCriterium"/> is <see langword="null" />.</exception>
/// <exception cref="ArgumentException">Thrown if <paramref name="stopCriterium"/> is of the same type as an already stored criterium.</exception>
void Add(IIterationStopCriterium<double> stopCriterium);
void Add(IIterationStopCriterium<T> stopCriterium);
/// <summary>
/// Removes the <see cref="IIterationStopCriterium{T}"/> from the internal collection.
/// </summary>
/// <param name="stopCriterium">The stop criterium that must be removed.</param>
void Remove(IIterationStopCriterium<double> stopCriterium);
void Remove(IIterationStopCriterium<T> stopCriterium);
/// <summary>
/// Indicates if the specific stop criterium is stored by the <see cref="IIterator"/>.
/// Indicates if the specific stop criterium is stored by the <see cref="IIterator{T}"/>.
/// </summary>
/// <param name="stopCriterium">The stop criterium.</param>
/// <returns><c>true</c> if the <see cref="IIterator"/> contains the stop criterium; otherwise <c>false</c>.</returns>
bool Contains(IIterationStopCriterium<double> stopCriterium);
/// <returns><c>true</c> if the <see cref="IIterator{T}"/> contains the stop criterium; otherwise <c>false</c>.</returns>
bool Contains(IIterationStopCriterium<T> stopCriterium);
/// <summary>
/// Indicates to the iterator that the iterative process has been cancelled.
@ -69,7 +69,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// <summary>
/// Determines the status of the iterative calculation based on the stop criteria stored
/// by the current <see cref="IIterator"/>. Status is set to <c>Status</c> field of current object.
/// by the current <see cref="IIterator{T}"/>. Status is set to <c>Status</c> field of current object.
/// </summary>
/// <param name="iterationNumber">The number of iterations that have passed so far.</param>
/// <param name="solutionVector">The vector containing the current solution values.</param>
@ -80,7 +80,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// on the invocation of this method. Therefore this method should only be called if the
/// calculation has moved forwards at least one step.
/// </remarks>
void DetermineStatus(int iterationNumber, Vector<double> solutionVector, Vector<double> sourceVector, Vector<double> residualVector);
void DetermineStatus(int iterationNumber, Vector<T> solutionVector, Vector<T> sourceVector, Vector<T> residualVector);
/// <summary>
/// Gets the current calculation status.
@ -89,7 +89,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
ICalculationStatus Status { get; }
/// <summary>
/// Resets the <see cref="IIterator"/> to the pre-calculation state.
/// Resets the <see cref="IIterator{T}"/> to the pre-calculation state.
/// </summary>
/// <remarks>
/// Note to implementers: Invoking this method should not clear the user defined
@ -98,6 +98,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// </remarks>
void ResetToPrecalculationState();
IIterator Clone();
IIterator<T> Clone();
}
}

5
src/Numerics/Numerics.csproj

@ -192,7 +192,6 @@
<Compile Include="LinearAlgebra\Complex32\Matrix.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\IIterativeSolver.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\IIterativeSolverSetup.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\IIterator.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\Preconditioners\IPreConditioner.cs" />
<Compile Include="LinearAlgebra\Complex32\SparseMatrix.cs" />
<Compile Include="LinearAlgebra\Complex32\Vector.cs" />
@ -211,7 +210,6 @@
<Compile Include="LinearAlgebra\Complex\Matrix.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\IIterativeSolver.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\IIterativeSolverSetup.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\IIterator.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\Preconditioners\IPreConditioner.cs" />
<Compile Include="LinearAlgebra\Complex\SparseMatrix.cs" />
<Compile Include="LinearAlgebra\Complex\Vector.cs" />
@ -227,7 +225,7 @@
<Compile Include="LinearAlgebra\Double\Matrix.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\IIterativeSolver.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\IIterativeSolverSetup.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\IIterator.cs" />
<Compile Include="LinearAlgebra\Solvers\IIterator.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\Preconditioners\IPreConditioner.cs" />
<Compile Include="LinearAlgebra\Solvers\StopCriterium\IIterationStopCriterium.cs" />
<Compile Include="LinearAlgebra\Double\SparseMatrix.cs" />
@ -318,7 +316,6 @@
<Compile Include="LinearAlgebra\Single\Matrix.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\IIterativeSolver.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\IIterativeSolverSetup.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\IIterator.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\Iterative\BiCgStab.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\Iterative\CompositeSolver.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\Iterative\GpBiCg.cs" />

Loading…
Cancel
Save