Browse Source

LA: flattening iterative solver namespaces

optimization-1
Christoph Ruegg 13 years ago
parent
commit
78dc687d09
  1. 1
      src/Examples/LinearAlgebra/IterativeSolvers/BiCgStabSolver.cs
  2. 1
      src/Examples/LinearAlgebra/IterativeSolvers/CompositeSolverExample.cs
  3. 1
      src/Examples/LinearAlgebra/IterativeSolvers/GpBiCgSolver.cs
  4. 1
      src/Examples/LinearAlgebra/IterativeSolvers/MlkBiCgStabSolver.cs
  5. 1
      src/Examples/LinearAlgebra/IterativeSolvers/TFQMRSolver.cs
  6. 8
      src/Numerics/LinearAlgebra/Builder.cs
  7. 2
      src/Numerics/LinearAlgebra/Complex/Solvers/DiagonalPreconditioner.cs
  8. 2
      src/Numerics/LinearAlgebra/Complex/Solvers/DivergenceStopCriterium.cs
  9. 2
      src/Numerics/LinearAlgebra/Complex/Solvers/FailureStopCriterium.cs
  10. 2
      src/Numerics/LinearAlgebra/Complex/Solvers/ILU0Preconditioner.cs
  11. 2
      src/Numerics/LinearAlgebra/Complex/Solvers/ILUTPPreconditioner.cs
  12. 2
      src/Numerics/LinearAlgebra/Complex/Solvers/ResidualStopCriterium.cs
  13. 2
      src/Numerics/LinearAlgebra/Complex32/Solvers/DiagonalPreconditioner.cs
  14. 2
      src/Numerics/LinearAlgebra/Complex32/Solvers/DivergenceStopCriterium.cs
  15. 2
      src/Numerics/LinearAlgebra/Complex32/Solvers/FailureStopCriterium.cs
  16. 2
      src/Numerics/LinearAlgebra/Complex32/Solvers/ILU0Preconditioner.cs
  17. 2
      src/Numerics/LinearAlgebra/Complex32/Solvers/ILUTPPreconditioner.cs
  18. 2
      src/Numerics/LinearAlgebra/Complex32/Solvers/ResidualStopCriterium.cs
  19. 2
      src/Numerics/LinearAlgebra/Double/Solvers/DiagonalPreconditioner.cs
  20. 2
      src/Numerics/LinearAlgebra/Double/Solvers/DivergenceStopCriterium.cs
  21. 2
      src/Numerics/LinearAlgebra/Double/Solvers/FailureStopCriterium.cs
  22. 2
      src/Numerics/LinearAlgebra/Double/Solvers/ILU0Preconditioner.cs
  23. 2
      src/Numerics/LinearAlgebra/Double/Solvers/ILUTPPreconditioner.cs
  24. 2
      src/Numerics/LinearAlgebra/Double/Solvers/MILU0Preconditioner.cs
  25. 2
      src/Numerics/LinearAlgebra/Double/Solvers/ResidualStopCriterium.cs
  26. 2
      src/Numerics/LinearAlgebra/Single/Solvers/DiagonalPreconditioner.cs
  27. 2
      src/Numerics/LinearAlgebra/Single/Solvers/DivergenceStopCriterium.cs
  28. 2
      src/Numerics/LinearAlgebra/Single/Solvers/FailureStopCriterium.cs
  29. 2
      src/Numerics/LinearAlgebra/Single/Solvers/ILU0Preconditioner.cs
  30. 2
      src/Numerics/LinearAlgebra/Single/Solvers/ILUTPPreconditioner.cs
  31. 2
      src/Numerics/LinearAlgebra/Single/Solvers/ResidualStopCriterium.cs
  32. 2
      src/Numerics/LinearAlgebra/Solvers/UnitPreconditioner.cs
  33. 50
      src/Numerics/Numerics.csproj
  34. 1
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/Iterative/BiCgStabTest.cs
  35. 1
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/Iterative/GpBiCgTest.cs
  36. 1
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/Iterative/MlkBiCgStabTest.cs
  37. 1
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/Iterative/TFQMRTest.cs
  38. 34
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/IteratorTest.cs
  39. 10
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/DiagonalTest.cs
  40. 31
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/IluptElementSorterTest.cs
  41. 70
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/IlutpTest.cs
  42. 18
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/IncompleteLUTest.cs
  43. 6
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/PreConditionerTest.cs
  44. 6
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/UnitPreconditionerTest.cs
  45. 2
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/StopCriterium/DivergenceStopCriteriumTest.cs
  46. 2
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/StopCriterium/FailureStopCriteriumTest.cs
  47. 2
      src/UnitTests/LinearAlgebraTests/Complex/Solvers/StopCriterium/ResidualStopCriteriumTest.cs
  48. 1
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Iterative/BiCgStabTest.cs
  49. 1
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Iterative/GpBiCgTest.cs
  50. 1
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Iterative/MlkBiCgStabTest.cs
  51. 1
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Iterative/TFQMRTest.cs
  52. 34
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/IteratorTest.cs
  53. 10
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/DiagonalTest.cs
  54. 30
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/IluptElementSorterTest.cs
  55. 70
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/IlutpTest.cs
  56. 18
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/IncompleteLUTest.cs
  57. 6
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/PreConditionerTest.cs
  58. 6
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/UnitPreconditionerTest.cs
  59. 2
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/StopCriterium/DivergenceStopCriteriumTest.cs
  60. 2
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/StopCriterium/FailureStopCriteriumTest.cs
  61. 2
      src/UnitTests/LinearAlgebraTests/Complex32/Solvers/StopCriterium/ResidualStopCriteriumTest.cs
  62. 1
      src/UnitTests/LinearAlgebraTests/Double/Solvers/Iterative/BiCgStabTest.cs
  63. 1
      src/UnitTests/LinearAlgebraTests/Double/Solvers/Iterative/GpBiCgTest.cs
  64. 1
      src/UnitTests/LinearAlgebraTests/Double/Solvers/Iterative/MlkBiCgStabTest.cs
  65. 1
      src/UnitTests/LinearAlgebraTests/Double/Solvers/Iterative/TFQMRTest.cs
  66. 34
      src/UnitTests/LinearAlgebraTests/Double/Solvers/IteratorTest.cs
  67. 10
      src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/DiagonalTest.cs
  68. 30
      src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/IluptElementSorterTest.cs
  69. 70
      src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/IlutpTest.cs
  70. 18
      src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/IncompleteLUTest.cs
  71. 6
      src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/PreConditionerTest.cs
  72. 3
      src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/UnitPreconditionerTest.cs
  73. 2
      src/UnitTests/LinearAlgebraTests/Double/Solvers/StopCriterium/DivergenceStopCriteriumTest.cs
  74. 30
      src/UnitTests/LinearAlgebraTests/Double/Solvers/StopCriterium/FailureStopCriteriumTest.cs
  75. 2
      src/UnitTests/LinearAlgebraTests/Double/Solvers/StopCriterium/ResidualStopCriteriumTest.cs
  76. 1
      src/UnitTests/LinearAlgebraTests/Single/Solvers/Iterative/BiCgStabTest.cs
  77. 1
      src/UnitTests/LinearAlgebraTests/Single/Solvers/Iterative/GpBiCgTest.cs
  78. 1
      src/UnitTests/LinearAlgebraTests/Single/Solvers/Iterative/MlkBiCgStabTest.cs
  79. 1
      src/UnitTests/LinearAlgebraTests/Single/Solvers/Iterative/TFQMRTest.cs
  80. 34
      src/UnitTests/LinearAlgebraTests/Single/Solvers/IteratorTest.cs
  81. 12
      src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/DiagonalTest.cs
  82. 30
      src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/IluptElementSorterTest.cs
  83. 76
      src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/IlutpTest.cs
  84. 20
      src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/IncompleteLUTest.cs
  85. 6
      src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/PreConditionerTest.cs
  86. 9
      src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/UnitPreconditionerTest.cs
  87. 2
      src/UnitTests/LinearAlgebraTests/Single/Solvers/StopCriterium/DivergenceStopCriteriumTest.cs
  88. 4
      src/UnitTests/LinearAlgebraTests/Single/Solvers/StopCriterium/FailureStopCriteriumTest.cs
  89. 2
      src/UnitTests/LinearAlgebraTests/Single/Solvers/StopCriterium/ResidualStopCriteriumTest.cs

1
src/Examples/LinearAlgebra/IterativeSolvers/BiCgStabSolver.cs

@ -32,7 +32,6 @@ using System;
using System.Globalization; using System.Globalization;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
namespace Examples.LinearAlgebra.IterativeSolversExamples namespace Examples.LinearAlgebra.IterativeSolversExamples

1
src/Examples/LinearAlgebra/IterativeSolvers/CompositeSolverExample.cs

@ -33,7 +33,6 @@ using System.Globalization;
using System.Reflection; using System.Reflection;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
namespace Examples.LinearAlgebra.IterativeSolversExamples namespace Examples.LinearAlgebra.IterativeSolversExamples

1
src/Examples/LinearAlgebra/IterativeSolvers/GpBiCgSolver.cs

@ -32,7 +32,6 @@ using System;
using System.Globalization; using System.Globalization;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
namespace Examples.LinearAlgebra.IterativeSolversExamples namespace Examples.LinearAlgebra.IterativeSolversExamples

1
src/Examples/LinearAlgebra/IterativeSolvers/MlkBiCgStabSolver.cs

@ -32,7 +32,6 @@ using System;
using System.Globalization; using System.Globalization;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
namespace Examples.LinearAlgebra.IterativeSolversExamples namespace Examples.LinearAlgebra.IterativeSolversExamples

1
src/Examples/LinearAlgebra/IterativeSolvers/TFQMRSolver.cs

@ -32,7 +32,6 @@ using System;
using System.Globalization; using System.Globalization;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
namespace Examples.LinearAlgebra.IterativeSolversExamples namespace Examples.LinearAlgebra.IterativeSolversExamples

8
src/Numerics/LinearAlgebra/Builder.cs

@ -33,7 +33,7 @@ using MathNet.Numerics.LinearAlgebra.Solvers;
namespace MathNet.Numerics.LinearAlgebra.Double namespace MathNet.Numerics.LinearAlgebra.Double
{ {
using Solvers.StopCriterium; using Solvers;
internal class GenericBuilder : IGenericBuilder<double> internal class GenericBuilder : IGenericBuilder<double>
{ {
@ -82,7 +82,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
namespace MathNet.Numerics.LinearAlgebra.Single namespace MathNet.Numerics.LinearAlgebra.Single
{ {
using Solvers.StopCriterium; using Solvers;
internal class GenericBuilder : IGenericBuilder<float> internal class GenericBuilder : IGenericBuilder<float>
{ {
@ -131,7 +131,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
namespace MathNet.Numerics.LinearAlgebra.Complex namespace MathNet.Numerics.LinearAlgebra.Complex
{ {
using Solvers.StopCriterium; using Solvers;
#if NOSYSNUMERICS #if NOSYSNUMERICS
using Complex = Numerics.Complex; using Complex = Numerics.Complex;
@ -186,7 +186,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
namespace MathNet.Numerics.LinearAlgebra.Complex32 namespace MathNet.Numerics.LinearAlgebra.Complex32
{ {
using Solvers.StopCriterium; using Solvers;
internal class GenericBuilder : IGenericBuilder<Numerics.Complex32> internal class GenericBuilder : IGenericBuilder<Numerics.Complex32>
{ {

2
src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/DiagonalPreconditioner.cs → src/Numerics/LinearAlgebra/Complex/Solvers/DiagonalPreconditioner.cs

@ -32,7 +32,7 @@ using System;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{ {
#if NOSYSNUMERICS #if NOSYSNUMERICS

2
src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/DivergenceStopCriterium.cs → src/Numerics/LinearAlgebra/Complex/Solvers/DivergenceStopCriterium.cs

@ -32,7 +32,7 @@ using MathNet.Numerics.LinearAlgebra.Solvers;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{ {
#if NOSYSNUMERICS #if NOSYSNUMERICS

2
src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/FailureStopCriterium.cs → src/Numerics/LinearAlgebra/Complex/Solvers/FailureStopCriterium.cs

@ -33,7 +33,7 @@ using System.Diagnostics;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{ {
#if NOSYSNUMERICS #if NOSYSNUMERICS

2
src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/ILU0Preconditioner.cs → src/Numerics/LinearAlgebra/Complex/Solvers/ILU0Preconditioner.cs

@ -32,7 +32,7 @@ using System;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{ {
#if NOSYSNUMERICS #if NOSYSNUMERICS

2
src/Numerics/LinearAlgebra/Complex/Solvers/Preconditioners/ILUTPPreconditioner.cs → src/Numerics/LinearAlgebra/Complex/Solvers/ILUTPPreconditioner.cs

@ -33,7 +33,7 @@ using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{ {
#if NOSYSNUMERICS #if NOSYSNUMERICS

2
src/Numerics/LinearAlgebra/Complex/Solvers/StopCriterium/ResidualStopCriterium.cs → src/Numerics/LinearAlgebra/Complex/Solvers/ResidualStopCriterium.cs

@ -33,7 +33,7 @@ using System.Diagnostics;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{ {
#if NOSYSNUMERICS #if NOSYSNUMERICS

2
src/Numerics/LinearAlgebra/Complex32/Solvers/Preconditioners/DiagonalPreconditioner.cs → src/Numerics/LinearAlgebra/Complex32/Solvers/DiagonalPreconditioner.cs

@ -32,7 +32,7 @@ using System;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{ {
using Numerics; using Numerics;

2
src/Numerics/LinearAlgebra/Complex32/Solvers/StopCriterium/DivergenceStopCriterium.cs → src/Numerics/LinearAlgebra/Complex32/Solvers/DivergenceStopCriterium.cs

@ -32,7 +32,7 @@ using MathNet.Numerics.LinearAlgebra.Solvers;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{ {
using Numerics; using Numerics;

2
src/Numerics/LinearAlgebra/Complex32/Solvers/StopCriterium/FailureStopCriterium.cs → src/Numerics/LinearAlgebra/Complex32/Solvers/FailureStopCriterium.cs

@ -33,7 +33,7 @@ using System.Diagnostics;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{ {
using Numerics; using Numerics;

2
src/Numerics/LinearAlgebra/Complex32/Solvers/Preconditioners/ILU0Preconditioner.cs → src/Numerics/LinearAlgebra/Complex32/Solvers/ILU0Preconditioner.cs

@ -32,7 +32,7 @@ using System;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{ {
using Numerics; using Numerics;

2
src/Numerics/LinearAlgebra/Complex32/Solvers/Preconditioners/ILUTPPreconditioner.cs → src/Numerics/LinearAlgebra/Complex32/Solvers/ILUTPPreconditioner.cs

@ -33,7 +33,7 @@ using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{ {
using Numerics; using Numerics;

2
src/Numerics/LinearAlgebra/Complex32/Solvers/StopCriterium/ResidualStopCriterium.cs → src/Numerics/LinearAlgebra/Complex32/Solvers/ResidualStopCriterium.cs

@ -33,7 +33,7 @@ using System.Diagnostics;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{ {
using Numerics; using Numerics;

2
src/Numerics/LinearAlgebra/Double/Solvers/Preconditioners/DiagonalPreconditioner.cs → src/Numerics/LinearAlgebra/Double/Solvers/DiagonalPreconditioner.cs

@ -32,7 +32,7 @@ using System;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{ {
/// <summary> /// <summary>
/// A diagonal preconditioner. The preconditioner uses the inverse /// A diagonal preconditioner. The preconditioner uses the inverse

2
src/Numerics/LinearAlgebra/Double/Solvers/StopCriterium/DivergenceStopCriterium.cs → src/Numerics/LinearAlgebra/Double/Solvers/DivergenceStopCriterium.cs

@ -32,7 +32,7 @@ using MathNet.Numerics.LinearAlgebra.Solvers;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{ {
/// <summary> /// <summary>
/// Monitors an iterative calculation for signs of divergence. /// Monitors an iterative calculation for signs of divergence.

2
src/Numerics/LinearAlgebra/Double/Solvers/StopCriterium/FailureStopCriterium.cs → src/Numerics/LinearAlgebra/Double/Solvers/FailureStopCriterium.cs

@ -33,7 +33,7 @@ using System.Diagnostics;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{ {
/// <summary> /// <summary>
/// Defines an <see cref="IIterationStopCriterium{T}"/> that monitors residuals for NaN's. /// Defines an <see cref="IIterationStopCriterium{T}"/> that monitors residuals for NaN's.

2
src/Numerics/LinearAlgebra/Double/Solvers/Preconditioners/ILU0Preconditioner.cs → src/Numerics/LinearAlgebra/Double/Solvers/ILU0Preconditioner.cs

@ -32,7 +32,7 @@ using System;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{ {
/// <summary> /// <summary>
/// An incomplete, level 0, LU factorization preconditioner. /// An incomplete, level 0, LU factorization preconditioner.

2
src/Numerics/LinearAlgebra/Double/Solvers/Preconditioners/ILUTPPreconditioner.cs → src/Numerics/LinearAlgebra/Double/Solvers/ILUTPPreconditioner.cs

@ -33,7 +33,7 @@ using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{ {
/// <summary> /// <summary>
/// This class performs an Incomplete LU factorization with drop tolerance /// This class performs an Incomplete LU factorization with drop tolerance

2
src/Numerics/LinearAlgebra/Double/Solvers/Preconditioners/MILU0Preconditioner.cs → src/Numerics/LinearAlgebra/Double/Solvers/MILU0Preconditioner.cs

@ -33,7 +33,7 @@ using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Storage; using MathNet.Numerics.LinearAlgebra.Storage;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{ {
/// <summary> /// <summary>
/// Milu0 is a simple milu(0) preconditioner. /// Milu0 is a simple milu(0) preconditioner.

2
src/Numerics/LinearAlgebra/Double/Solvers/StopCriterium/ResidualStopCriterium.cs → src/Numerics/LinearAlgebra/Double/Solvers/ResidualStopCriterium.cs

@ -33,7 +33,7 @@ using System.Diagnostics;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{ {
/// <summary> /// <summary>
/// Defines an <see cref="IIterationStopCriterium{T}"/> that monitors residuals as stop criterium. /// Defines an <see cref="IIterationStopCriterium{T}"/> that monitors residuals as stop criterium.

2
src/Numerics/LinearAlgebra/Single/Solvers/Preconditioners/DiagonalPreconditioner.cs → src/Numerics/LinearAlgebra/Single/Solvers/DiagonalPreconditioner.cs

@ -32,7 +32,7 @@ using System;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{ {
/// <summary> /// <summary>
/// A diagonal preconditioner. The preconditioner uses the inverse /// A diagonal preconditioner. The preconditioner uses the inverse

2
src/Numerics/LinearAlgebra/Single/Solvers/StopCriterium/DivergenceStopCriterium.cs → src/Numerics/LinearAlgebra/Single/Solvers/DivergenceStopCriterium.cs

@ -32,7 +32,7 @@ using MathNet.Numerics.LinearAlgebra.Solvers;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{ {
/// <summary> /// <summary>
/// Monitors an iterative calculation for signs of divergence. /// Monitors an iterative calculation for signs of divergence.

2
src/Numerics/LinearAlgebra/Single/Solvers/StopCriterium/FailureStopCriterium.cs → src/Numerics/LinearAlgebra/Single/Solvers/FailureStopCriterium.cs

@ -33,7 +33,7 @@ using System.Diagnostics;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{ {
/// <summary> /// <summary>
/// Defines an <see cref="IIterationStopCriterium{T}"/> that monitors residuals for NaN's. /// Defines an <see cref="IIterationStopCriterium{T}"/> that monitors residuals for NaN's.

2
src/Numerics/LinearAlgebra/Single/Solvers/Preconditioners/ILU0Preconditioner.cs → src/Numerics/LinearAlgebra/Single/Solvers/ILU0Preconditioner.cs

@ -32,7 +32,7 @@ using System;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{ {
/// <summary> /// <summary>
/// An incomplete, level 0, LU factorization preconditioner. /// An incomplete, level 0, LU factorization preconditioner.

2
src/Numerics/LinearAlgebra/Single/Solvers/Preconditioners/ILUTPPreconditioner.cs → src/Numerics/LinearAlgebra/Single/Solvers/ILUTPPreconditioner.cs

@ -33,7 +33,7 @@ using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.Preconditioners namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{ {
/// <summary> /// <summary>
/// This class performs an Incomplete LU factorization with drop tolerance /// This class performs an Incomplete LU factorization with drop tolerance

2
src/Numerics/LinearAlgebra/Single/Solvers/StopCriterium/ResidualStopCriterium.cs → src/Numerics/LinearAlgebra/Single/Solvers/ResidualStopCriterium.cs

@ -33,7 +33,7 @@ using System.Diagnostics;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties; using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{ {
/// <summary> /// <summary>
/// Defines an <see cref="IIterationStopCriterium{T}"/> that monitors residuals as stop criterium. /// Defines an <see cref="IIterationStopCriterium{T}"/> that monitors residuals as stop criterium.

2
src/Numerics/LinearAlgebra/Solvers/UnitPreconditioner.cs

@ -38,7 +38,7 @@ namespace MathNet.Numerics.LinearAlgebra.Solvers
/// it is only used when running an <see cref="IIterativeSolver{T}"/> without /// it is only used when running an <see cref="IIterativeSolver{T}"/> without
/// a preconditioner. /// a preconditioner.
/// </summary> /// </summary>
internal sealed class UnitPreconditioner<T> : IPreconditioner<T> where T : struct, IEquatable<T>, IFormattable public sealed class UnitPreconditioner<T> : IPreconditioner<T> where T : struct, IEquatable<T>, IFormattable
{ {
/// <summary> /// <summary>
/// The coefficient matrix on which this preconditioner operates. /// The coefficient matrix on which this preconditioner operates.

50
src/Numerics/Numerics.csproj

@ -122,7 +122,7 @@
<Compile Include="Distributions\Wishart.cs" /> <Compile Include="Distributions\Wishart.cs" />
<Compile Include="Distributions\Zipf.cs" /> <Compile Include="Distributions\Zipf.cs" />
<Compile Include="LinearAlgebra\Builder.cs" /> <Compile Include="LinearAlgebra\Builder.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\Preconditioners\MILU0Preconditioner.cs" /> <Compile Include="LinearAlgebra\Double\Solvers\MILU0Preconditioner.cs" />
<Compile Include="LinearAlgebra\Matrix.Solve.cs" /> <Compile Include="LinearAlgebra\Matrix.Solve.cs" />
<Compile Include="LinearAlgebra\Solvers\CancellationStopCriterium.cs" /> <Compile Include="LinearAlgebra\Solvers\CancellationStopCriterium.cs" />
<Compile Include="LinearAlgebra\Solvers\IterationStatus.cs" /> <Compile Include="LinearAlgebra\Solvers\IterationStatus.cs" />
@ -244,12 +244,12 @@
<Compile Include="LinearAlgebra\Complex32\Solvers\GpBiCg.cs" /> <Compile Include="LinearAlgebra\Complex32\Solvers\GpBiCg.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\MlkBiCgStab.cs" /> <Compile Include="LinearAlgebra\Complex32\Solvers\MlkBiCgStab.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\TFQMR.cs" /> <Compile Include="LinearAlgebra\Complex32\Solvers\TFQMR.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\Preconditioners\DiagonalPreconditioner.cs" /> <Compile Include="LinearAlgebra\Complex32\Solvers\DiagonalPreconditioner.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\Preconditioners\ILUTPPreconditioner.cs" /> <Compile Include="LinearAlgebra\Complex32\Solvers\ILUTPPreconditioner.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\Preconditioners\ILU0Preconditioner.cs" /> <Compile Include="LinearAlgebra\Complex32\Solvers\ILU0Preconditioner.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\StopCriterium\DivergenceStopCriterium.cs" /> <Compile Include="LinearAlgebra\Complex32\Solvers\DivergenceStopCriterium.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\StopCriterium\FailureStopCriterium.cs" /> <Compile Include="LinearAlgebra\Complex32\Solvers\FailureStopCriterium.cs" />
<Compile Include="LinearAlgebra\Complex32\Solvers\StopCriterium\ResidualStopCriterium.cs" /> <Compile Include="LinearAlgebra\Complex32\Solvers\ResidualStopCriterium.cs" />
<Compile Include="LinearAlgebra\Complex32\SparseVector.cs" /> <Compile Include="LinearAlgebra\Complex32\SparseVector.cs" />
<Compile Include="LinearAlgebra\Complex\Factorization\DenseGramSchmidt.cs" /> <Compile Include="LinearAlgebra\Complex\Factorization\DenseGramSchmidt.cs" />
<Compile Include="LinearAlgebra\Complex\Factorization\DenseEvd.cs" /> <Compile Include="LinearAlgebra\Complex\Factorization\DenseEvd.cs" />
@ -268,12 +268,12 @@
<Compile Include="LinearAlgebra\Complex\Solvers\GpBiCg.cs" /> <Compile Include="LinearAlgebra\Complex\Solvers\GpBiCg.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\MlkBiCgStab.cs" /> <Compile Include="LinearAlgebra\Complex\Solvers\MlkBiCgStab.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\TFQMR.cs" /> <Compile Include="LinearAlgebra\Complex\Solvers\TFQMR.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\Preconditioners\DiagonalPreconditioner.cs" /> <Compile Include="LinearAlgebra\Complex\Solvers\DiagonalPreconditioner.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\Preconditioners\ILUTPPreconditioner.cs" /> <Compile Include="LinearAlgebra\Complex\Solvers\ILUTPPreconditioner.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\Preconditioners\ILU0Preconditioner.cs" /> <Compile Include="LinearAlgebra\Complex\Solvers\ILU0Preconditioner.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\StopCriterium\DivergenceStopCriterium.cs" /> <Compile Include="LinearAlgebra\Complex\Solvers\DivergenceStopCriterium.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\StopCriterium\FailureStopCriterium.cs" /> <Compile Include="LinearAlgebra\Complex\Solvers\FailureStopCriterium.cs" />
<Compile Include="LinearAlgebra\Complex\Solvers\StopCriterium\ResidualStopCriterium.cs" /> <Compile Include="LinearAlgebra\Complex\Solvers\ResidualStopCriterium.cs" />
<Compile Include="LinearAlgebra\Complex\SparseVector.cs" /> <Compile Include="LinearAlgebra\Complex\SparseVector.cs" />
<Compile Include="LinearAlgebra\Double\DenseVector.cs" /> <Compile Include="LinearAlgebra\Double\DenseVector.cs" />
<Compile Include="LinearAlgebra\Double\Factorization\DenseGramSchmidt.cs" /> <Compile Include="LinearAlgebra\Double\Factorization\DenseGramSchmidt.cs" />
@ -308,12 +308,12 @@
<Compile Include="LinearAlgebra\Single\Solvers\GpBiCg.cs" /> <Compile Include="LinearAlgebra\Single\Solvers\GpBiCg.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\MlkBiCgStab.cs" /> <Compile Include="LinearAlgebra\Single\Solvers\MlkBiCgStab.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\TFQMR.cs" /> <Compile Include="LinearAlgebra\Single\Solvers\TFQMR.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\Preconditioners\DiagonalPreconditioner.cs" /> <Compile Include="LinearAlgebra\Single\Solvers\DiagonalPreconditioner.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\Preconditioners\ILUTPPreconditioner.cs" /> <Compile Include="LinearAlgebra\Single\Solvers\ILUTPPreconditioner.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\Preconditioners\ILU0Preconditioner.cs" /> <Compile Include="LinearAlgebra\Single\Solvers\ILU0Preconditioner.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\StopCriterium\DivergenceStopCriterium.cs" /> <Compile Include="LinearAlgebra\Single\Solvers\DivergenceStopCriterium.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\StopCriterium\FailureStopCriterium.cs" /> <Compile Include="LinearAlgebra\Single\Solvers\FailureStopCriterium.cs" />
<Compile Include="LinearAlgebra\Single\Solvers\StopCriterium\ResidualStopCriterium.cs" /> <Compile Include="LinearAlgebra\Single\Solvers\ResidualStopCriterium.cs" />
<Compile Include="LinearAlgebra\Single\SparseMatrix.cs" /> <Compile Include="LinearAlgebra\Single\SparseMatrix.cs" />
<Compile Include="LinearAlgebra\Single\SparseVector.cs" /> <Compile Include="LinearAlgebra\Single\SparseVector.cs" />
<Compile Include="LinearAlgebra\Factorization\Cholesky.cs" /> <Compile Include="LinearAlgebra\Factorization\Cholesky.cs" />
@ -335,15 +335,15 @@
<Compile Include="LinearAlgebra\Double\Solvers\GpBiCg.cs" /> <Compile Include="LinearAlgebra\Double\Solvers\GpBiCg.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\MlkBiCgStab.cs" /> <Compile Include="LinearAlgebra\Double\Solvers\MlkBiCgStab.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\TFQMR.cs" /> <Compile Include="LinearAlgebra\Double\Solvers\TFQMR.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\Preconditioners\DiagonalPreconditioner.cs" /> <Compile Include="LinearAlgebra\Double\Solvers\DiagonalPreconditioner.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\Preconditioners\ILUTPPreconditioner.cs" /> <Compile Include="LinearAlgebra\Double\Solvers\ILUTPPreconditioner.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\Preconditioners\ILU0Preconditioner.cs"> <Compile Include="LinearAlgebra\Double\Solvers\ILU0Preconditioner.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="LinearAlgebra\Solvers\UnitPreconditioner.cs" /> <Compile Include="LinearAlgebra\Solvers\UnitPreconditioner.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\StopCriterium\DivergenceStopCriterium.cs" /> <Compile Include="LinearAlgebra\Double\Solvers\DivergenceStopCriterium.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\StopCriterium\FailureStopCriterium.cs" /> <Compile Include="LinearAlgebra\Double\Solvers\FailureStopCriterium.cs" />
<Compile Include="LinearAlgebra\Double\Solvers\StopCriterium\ResidualStopCriterium.cs" /> <Compile Include="LinearAlgebra\Double\Solvers\ResidualStopCriterium.cs" />
<Compile Include="LinearAlgebra\Double\SparseVector.cs" /> <Compile Include="LinearAlgebra\Double\SparseVector.cs" />
<Compile Include="LinearAlgebra\Matrix.Arithmetic.cs" /> <Compile Include="LinearAlgebra\Matrix.Arithmetic.cs" />
<Compile Include="LinearAlgebra\Matrix.cs" /> <Compile Include="LinearAlgebra\Matrix.cs" />

1
src/UnitTests/LinearAlgebraTests/Complex/Solvers/Iterative/BiCgStabTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Complex/Solvers/Iterative/GpBiCgTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Complex/Solvers/Iterative/MlkBiCgStabTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Complex/Solvers/Iterative/TFQMRTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

34
src/UnitTests/LinearAlgebraTests/Complex/Solvers/IteratorTest.cs

@ -31,7 +31,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -66,12 +66,12 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers
public void DetermineStatusWithNegativeIterationNumberThrowsArgumentOutOfRangeException() public void DetermineStatusWithNegativeIterationNumberThrowsArgumentOutOfRangeException()
{ {
var criteria = new List<IIterationStopCriterium<Complex>> var criteria = new List<IIterationStopCriterium<Complex>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<Complex>(), new IterationCountStopCriterium<Complex>(),
new ResidualStopCriterium() new ResidualStopCriterium()
}; };
var iterator = new Iterator<Complex>(criteria); var iterator = new Iterator<Complex>(criteria);
Assert.Throws<ArgumentOutOfRangeException>(() => iterator.DetermineStatus( Assert.Throws<ArgumentOutOfRangeException>(() => iterator.DetermineStatus(
@ -88,11 +88,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers
public void DetermineStatus() public void DetermineStatus()
{ {
var criteria = new List<IIterationStopCriterium<Complex>> var criteria = new List<IIterationStopCriterium<Complex>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<Complex>(1) new IterationCountStopCriterium<Complex>(1)
}; };
var iterator = new Iterator<Complex>(criteria); var iterator = new Iterator<Complex>(criteria);
@ -120,11 +120,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers
public void ResetToPrecalculationState() public void ResetToPrecalculationState()
{ {
var criteria = new List<IIterationStopCriterium<Complex>> var criteria = new List<IIterationStopCriterium<Complex>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<Complex>(1) new IterationCountStopCriterium<Complex>(1)
}; };
var iterator = new Iterator<Complex>(criteria); var iterator = new Iterator<Complex>(criteria);

10
src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/DiagonalTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -26,7 +30,7 @@
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -63,7 +67,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<Complex> preconditioner, SparseMatrix matrix, Vector<Complex> vector, Vector<Complex> result) protected override void CheckResult(IPreconditioner<Complex> preconditioner, SparseMatrix matrix, Vector<Complex> vector, Vector<Complex> result)
{ {
Assert.AreEqual(typeof(DiagonalPreconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (DiagonalPreconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal

31
src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/IluptElementSorterTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -26,12 +30,17 @@
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using NUnit.Framework; using NUnit.Framework;
namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Preconditioners namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Preconditioners
{ {
using System.Numerics;
#if NOSYSNUMERICS
using Complex = Numerics.Complex;
#else
using Complex = System.Numerics.Complex;
#endif
/// <summary> /// <summary>
/// Test for element sort algorithm of Ilupt class. /// Test for element sort algorithm of Ilupt class.
@ -45,7 +54,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
[Test] [Test]
public void HeapSortWithIncreasingIntegerArray() public void HeapSortWithIncreasingIntegerArray()
{ {
var sortedIndices = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var sortedIndices = new[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -59,7 +68,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
[Test] [Test]
public void HeapSortWithDecreasingIntegerArray() public void HeapSortWithDecreasingIntegerArray()
{ {
var sortedIndices = new[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; var sortedIndices = new[] {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -73,7 +82,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
[Test] [Test]
public void HeapSortWithRandomIntegerArray() public void HeapSortWithRandomIntegerArray()
{ {
var sortedIndices = new[] { 5, 2, 8, 6, 0, 4, 1, 7, 3, 9 }; var sortedIndices = new[] {5, 2, 8, 6, 0, 4, 1, 7, 3, 9};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -87,7 +96,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
[Test] [Test]
public void HeapSortWithDuplicateEntries() public void HeapSortWithDuplicateEntries()
{ {
var sortedIndices = new[] { 1, 1, 1, 1, 2, 2, 2, 2, 3, 4 }; var sortedIndices = new[] {1, 1, 1, 1, 2, 2, 2, 2, 3, 4};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -128,7 +137,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
[Test] [Test]
public void HeapSortWithSpecialConstructedIntegerArray() public void HeapSortWithSpecialConstructedIntegerArray()
{ {
var sortedIndices = new[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }; var sortedIndices = new[] {0, 0, 0, 0, 0, 1, 0, 0, 0, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -139,7 +148,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
} }
} }
sortedIndices = new[] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; sortedIndices = new[] {1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -150,7 +159,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
} }
} }
sortedIndices = new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; sortedIndices = new[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -161,7 +170,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
} }
} }
sortedIndices = new[] { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 }; sortedIndices = new[] {1, 1, 1, 0, 1, 1, 1, 1, 1, 1};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {

70
src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/IlutpTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -28,7 +32,7 @@ using System;
using System.Reflection; using System.Reflection;
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -50,17 +54,17 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// <summary> /// <summary>
/// The drop tolerance. /// The drop tolerance.
/// </summary> /// </summary>
private double _dropTolerance = 0.1; double _dropTolerance = 0.1;
/// <summary> /// <summary>
/// The fill level. /// The fill level.
/// </summary> /// </summary>
private double _fillLevel = 1.0; double _fillLevel = 1.0;
/// <summary> /// <summary>
/// The pivot tolerance. /// The pivot tolerance.
/// </summary> /// </summary>
private double _pivotTolerance = 1.0; double _pivotTolerance = 1.0;
/// <summary> /// <summary>
/// Setup default parameters. /// Setup default parameters.
@ -80,7 +84,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <param name="methodName">Method name.</param> /// <param name="methodName">Method name.</param>
/// <returns>Result of the method invocation.</returns> /// <returns>Result of the method invocation.</returns>
private static T GetMethod<T>(ILUTPPreconditioner ilutp, string methodName) static T GetMethod<T>(ILUTPPreconditioner ilutp, string methodName)
{ {
var type = ilutp.GetType(); var type = ilutp.GetType();
var methodInfo = type.GetMethod( var methodInfo = type.GetMethod(
@ -91,7 +95,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
new Type[0], new Type[0],
null); null);
var obj = methodInfo.Invoke(ilutp, null); var obj = methodInfo.Invoke(ilutp, null);
return (T)obj; return (T) obj;
} }
/// <summary> /// <summary>
@ -99,7 +103,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Upper triangle.</returns> /// <returns>Upper triangle.</returns>
private static SparseMatrix GetUpperTriangle(ILUTPPreconditioner ilutp) static SparseMatrix GetUpperTriangle(ILUTPPreconditioner ilutp)
{ {
return GetMethod<SparseMatrix>(ilutp, "UpperTriangle"); return GetMethod<SparseMatrix>(ilutp, "UpperTriangle");
} }
@ -109,7 +113,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Lower triangle.</returns> /// <returns>Lower triangle.</returns>
private static SparseMatrix GetLowerTriangle(ILUTPPreconditioner ilutp) static SparseMatrix GetLowerTriangle(ILUTPPreconditioner ilutp)
{ {
return GetMethod<SparseMatrix>(ilutp, "LowerTriangle"); return GetMethod<SparseMatrix>(ilutp, "LowerTriangle");
} }
@ -119,7 +123,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Pivots array.</returns> /// <returns>Pivots array.</returns>
private static int[] GetPivots(ILUTPPreconditioner ilutp) static int[] GetPivots(ILUTPPreconditioner ilutp)
{ {
return GetMethod<int[]>(ilutp, "Pivots"); return GetMethod<int[]>(ilutp, "Pivots");
} }
@ -129,7 +133,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// </summary> /// </summary>
/// <param name="size">Matrix order.</param> /// <param name="size">Matrix order.</param>
/// <returns>Reverse Unit matrix.</returns> /// <returns>Reverse Unit matrix.</returns>
private static SparseMatrix CreateReverseUnitMatrix(int size) static SparseMatrix CreateReverseUnitMatrix(int size)
{ {
var matrix = new SparseMatrix(size); var matrix = new SparseMatrix(size);
for (var i = 0; i < size; i++) for (var i = 0; i < size; i++)
@ -144,14 +148,14 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// Create preconditioner (internal) /// Create preconditioner (internal)
/// </summary> /// </summary>
/// <returns>Ilutp instance.</returns> /// <returns>Ilutp instance.</returns>
private ILUTPPreconditioner InternalCreatePreconditioner() ILUTPPreconditioner InternalCreatePreconditioner()
{ {
var result = new ILUTPPreconditioner var result = new ILUTPPreconditioner
{ {
DropTolerance = _dropTolerance, DropTolerance = _dropTolerance,
FillLevel = _fillLevel, FillLevel = _fillLevel,
PivotTolerance = _pivotTolerance PivotTolerance = _pivotTolerance
}; };
return result; return result;
} }
@ -176,7 +180,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<Complex> preconditioner, SparseMatrix matrix, Vector<Complex> vector, Vector<Complex> result) protected override void CheckResult(IPreconditioner<Complex> preconditioner, SparseMatrix matrix, Vector<Complex> vector, Vector<Complex> result)
{ {
Assert.AreEqual(typeof(ILUTPPreconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (ILUTPPreconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal
@ -249,11 +253,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
sparseMatrix[2, 1] = 8; sparseMatrix[2, 1] = 8;
sparseMatrix[2, 2] = 9; sparseMatrix[2, 2] = 9;
var ilu = new ILUTPPreconditioner var ilu = new ILUTPPreconditioner
{ {
PivotTolerance = 0.0, PivotTolerance = 0.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
ilu.Initialize(sparseMatrix); ilu.Initialize(sparseMatrix);
var l = GetLowerTriangle(ilu); var l = GetLowerTriangle(ilu);
@ -305,11 +309,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
sparseMatrix[2, 1] = 8; sparseMatrix[2, 1] = 8;
sparseMatrix[2, 2] = 9; sparseMatrix[2, 2] = 9;
var ilu = new ILUTPPreconditioner var ilu = new ILUTPPreconditioner
{ {
PivotTolerance = 1.0, PivotTolerance = 1.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
ilu.Initialize(sparseMatrix); ilu.Initialize(sparseMatrix);
var l = GetLowerTriangle(ilu); var l = GetLowerTriangle(ilu);
var u = GetUpperTriangle(ilu); var u = GetUpperTriangle(ilu);
@ -342,11 +346,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
var newMatrix = CreateReverseUnitMatrix(Size); var newMatrix = CreateReverseUnitMatrix(Size);
var vector = CreateStandardBcVector(Size); var vector = CreateStandardBcVector(Size);
var preconditioner = new ILUTPPreconditioner var preconditioner = new ILUTPPreconditioner
{ {
PivotTolerance = 1.0, PivotTolerance = 1.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
preconditioner.Initialize(newMatrix); preconditioner.Initialize(newMatrix);
var result = new DenseVector(vector.Count); var result = new DenseVector(vector.Count);
preconditioner.Approximate(vector, result); preconditioner.Approximate(vector, result);

18
src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/IncompleteLUTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -28,7 +32,7 @@ using System;
using System.Reflection; using System.Reflection;
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -54,7 +58,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <param name="methodName">Method name.</param> /// <param name="methodName">Method name.</param>
/// <returns>Result of the method invocation.</returns> /// <returns>Result of the method invocation.</returns>
private static T GetMethod<T>(ILU0Preconditioner ilu, string methodName) static T GetMethod<T>(ILU0Preconditioner ilu, string methodName)
{ {
var type = ilu.GetType(); var type = ilu.GetType();
var methodInfo = type.GetMethod( var methodInfo = type.GetMethod(
@ -65,7 +69,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
new Type[0], new Type[0],
null); null);
var obj = methodInfo.Invoke(ilu, null); var obj = methodInfo.Invoke(ilu, null);
return (T)obj; return (T) obj;
} }
/// <summary> /// <summary>
@ -73,7 +77,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// </summary> /// </summary>
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <returns>Upper triangle.</returns> /// <returns>Upper triangle.</returns>
private static Matrix<Complex> GetUpperTriangle(ILU0Preconditioner ilu) static Matrix<Complex> GetUpperTriangle(ILU0Preconditioner ilu)
{ {
return GetMethod<Matrix<Complex>>(ilu, "UpperTriangle"); return GetMethod<Matrix<Complex>>(ilu, "UpperTriangle");
} }
@ -83,7 +87,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// </summary> /// </summary>
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <returns>Lower triangle.</returns> /// <returns>Lower triangle.</returns>
private static Matrix<Complex> GetLowerTriangle(ILU0Preconditioner ilu) static Matrix<Complex> GetLowerTriangle(ILU0Preconditioner ilu)
{ {
return GetMethod<Matrix<Complex>>(ilu, "LowerTriangle"); return GetMethod<Matrix<Complex>>(ilu, "LowerTriangle");
} }
@ -106,7 +110,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Precondi
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<Complex> preconditioner, SparseMatrix matrix, Vector<Complex> vector, Vector<Complex> result) protected override void CheckResult(IPreconditioner<Complex> preconditioner, SparseMatrix matrix, Vector<Complex> vector, Vector<Complex> result)
{ {
Assert.AreEqual(typeof(ILU0Preconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (ILU0Preconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal

6
src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/PreConditionerTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND

6
src/UnitTests/LinearAlgebraTests/Complex/Solvers/Preconditioners/UnitPreconditionerTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND

2
src/UnitTests/LinearAlgebraTests/Complex/Solvers/StopCriterium/DivergenceStopCriteriumTest.cs

@ -30,7 +30,7 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

2
src/UnitTests/LinearAlgebraTests/Complex/Solvers/StopCriterium/FailureStopCriteriumTest.cs

@ -30,7 +30,7 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

2
src/UnitTests/LinearAlgebraTests/Complex/Solvers/StopCriterium/ResidualStopCriteriumTest.cs

@ -30,7 +30,7 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex; using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Iterative/BiCgStabTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex32; using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers; using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Iterative/GpBiCgTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex32; using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers; using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Iterative/MlkBiCgStabTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex32; using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers; using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Iterative/TFQMRTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex32; using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers; using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

34
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/IteratorTest.cs

@ -31,7 +31,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra.Complex32; using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -66,12 +66,12 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers
public void DetermineStatusWithNegativeIterationNumberThrowsArgumentOutOfRangeException() public void DetermineStatusWithNegativeIterationNumberThrowsArgumentOutOfRangeException()
{ {
var criteria = new List<IIterationStopCriterium<Complex32>> var criteria = new List<IIterationStopCriterium<Complex32>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<Complex32>(), new IterationCountStopCriterium<Complex32>(),
new ResidualStopCriterium() new ResidualStopCriterium()
}; };
var iterator = new Iterator<Complex32>(criteria); var iterator = new Iterator<Complex32>(criteria);
Assert.Throws<ArgumentOutOfRangeException>(() => iterator.DetermineStatus( Assert.Throws<ArgumentOutOfRangeException>(() => iterator.DetermineStatus(
@ -88,11 +88,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers
public void DetermineStatus() public void DetermineStatus()
{ {
var criteria = new List<IIterationStopCriterium<Complex32>> var criteria = new List<IIterationStopCriterium<Complex32>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<Complex32>(1) new IterationCountStopCriterium<Complex32>(1)
}; };
var iterator = new Iterator<Complex32>(criteria); var iterator = new Iterator<Complex32>(criteria);
@ -120,11 +120,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers
public void ResetToPrecalculationState() public void ResetToPrecalculationState()
{ {
var criteria = new List<IIterationStopCriterium<Complex32>> var criteria = new List<IIterationStopCriterium<Complex32>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<Complex32>(1) new IterationCountStopCriterium<Complex32>(1)
}; };
var iterator = new Iterator<Complex32>(criteria); var iterator = new Iterator<Complex32>(criteria);

10
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/DiagonalTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -26,7 +30,7 @@
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Complex32; using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -58,7 +62,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<Complex32> preconditioner, SparseMatrix matrix, Vector<Complex32> vector, Vector<Complex32> result) protected override void CheckResult(IPreconditioner<Complex32> preconditioner, SparseMatrix matrix, Vector<Complex32> vector, Vector<Complex32> result)
{ {
Assert.AreEqual(typeof(DiagonalPreconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (DiagonalPreconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal

30
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/IluptElementSorterTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -24,12 +28,12 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// </copyright> // </copyright>
using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using NUnit.Framework;
namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Preconditioners namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Preconditioners
{ {
using LinearAlgebra.Complex32;
using LinearAlgebra.Complex32.Solvers.Preconditioners;
using NUnit.Framework;
/// <summary> /// <summary>
/// Test for element sort algorithm of Ilupt class. /// Test for element sort algorithm of Ilupt class.
/// </summary> /// </summary>
@ -42,7 +46,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
[Test] [Test]
public void HeapSortWithIncreasingIntegerArray() public void HeapSortWithIncreasingIntegerArray()
{ {
var sortedIndices = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var sortedIndices = new[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -56,7 +60,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
[Test] [Test]
public void HeapSortWithDecreasingIntegerArray() public void HeapSortWithDecreasingIntegerArray()
{ {
var sortedIndices = new[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; var sortedIndices = new[] {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -70,7 +74,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
[Test] [Test]
public void HeapSortWithRandomIntegerArray() public void HeapSortWithRandomIntegerArray()
{ {
var sortedIndices = new[] { 5, 2, 8, 6, 0, 4, 1, 7, 3, 9 }; var sortedIndices = new[] {5, 2, 8, 6, 0, 4, 1, 7, 3, 9};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -84,7 +88,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
[Test] [Test]
public void HeapSortWithDuplicateEntries() public void HeapSortWithDuplicateEntries()
{ {
var sortedIndices = new[] { 1, 1, 1, 1, 2, 2, 2, 2, 3, 4 }; var sortedIndices = new[] {1, 1, 1, 1, 2, 2, 2, 2, 3, 4};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -125,7 +129,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
[Test] [Test]
public void HeapSortWithSpecialConstructedIntegerArray() public void HeapSortWithSpecialConstructedIntegerArray()
{ {
var sortedIndices = new[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }; var sortedIndices = new[] {0, 0, 0, 0, 0, 1, 0, 0, 0, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -136,7 +140,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
} }
} }
sortedIndices = new[] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; sortedIndices = new[] {1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -147,7 +151,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
} }
} }
sortedIndices = new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; sortedIndices = new[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -158,7 +162,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
} }
} }
sortedIndices = new[] { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 }; sortedIndices = new[] {1, 1, 1, 0, 1, 1, 1, 1, 1, 1};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {

70
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/IlutpTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -28,7 +32,7 @@ using System;
using System.Reflection; using System.Reflection;
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Complex32; using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -45,17 +49,17 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// <summary> /// <summary>
/// The drop tolerance. /// The drop tolerance.
/// </summary> /// </summary>
private double _dropTolerance = 0.1; double _dropTolerance = 0.1;
/// <summary> /// <summary>
/// The fill level. /// The fill level.
/// </summary> /// </summary>
private double _fillLevel = 1.0; double _fillLevel = 1.0;
/// <summary> /// <summary>
/// The pivot tolerance. /// The pivot tolerance.
/// </summary> /// </summary>
private double _pivotTolerance = 1.0; double _pivotTolerance = 1.0;
/// <summary> /// <summary>
/// Setup default parameters. /// Setup default parameters.
@ -75,7 +79,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <param name="methodName">Method name.</param> /// <param name="methodName">Method name.</param>
/// <returns>Result of the method invocation.</returns> /// <returns>Result of the method invocation.</returns>
private static T GetMethod<T>(ILUTPPreconditioner ilutp, string methodName) static T GetMethod<T>(ILUTPPreconditioner ilutp, string methodName)
{ {
var type = ilutp.GetType(); var type = ilutp.GetType();
var methodInfo = type.GetMethod( var methodInfo = type.GetMethod(
@ -86,7 +90,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
new Type[0], new Type[0],
null); null);
var obj = methodInfo.Invoke(ilutp, null); var obj = methodInfo.Invoke(ilutp, null);
return (T)obj; return (T) obj;
} }
/// <summary> /// <summary>
@ -94,7 +98,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Upper triangle.</returns> /// <returns>Upper triangle.</returns>
private static SparseMatrix GetUpperTriangle(ILUTPPreconditioner ilutp) static SparseMatrix GetUpperTriangle(ILUTPPreconditioner ilutp)
{ {
return GetMethod<SparseMatrix>(ilutp, "UpperTriangle"); return GetMethod<SparseMatrix>(ilutp, "UpperTriangle");
} }
@ -104,7 +108,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Lower triangle.</returns> /// <returns>Lower triangle.</returns>
private static SparseMatrix GetLowerTriangle(ILUTPPreconditioner ilutp) static SparseMatrix GetLowerTriangle(ILUTPPreconditioner ilutp)
{ {
return GetMethod<SparseMatrix>(ilutp, "LowerTriangle"); return GetMethod<SparseMatrix>(ilutp, "LowerTriangle");
} }
@ -114,7 +118,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Pivots array.</returns> /// <returns>Pivots array.</returns>
private static int[] GetPivots(ILUTPPreconditioner ilutp) static int[] GetPivots(ILUTPPreconditioner ilutp)
{ {
return GetMethod<int[]>(ilutp, "Pivots"); return GetMethod<int[]>(ilutp, "Pivots");
} }
@ -124,7 +128,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// </summary> /// </summary>
/// <param name="size">Matrix order.</param> /// <param name="size">Matrix order.</param>
/// <returns>Reverse Unit matrix.</returns> /// <returns>Reverse Unit matrix.</returns>
private static SparseMatrix CreateReverseUnitMatrix(int size) static SparseMatrix CreateReverseUnitMatrix(int size)
{ {
var matrix = new SparseMatrix(size); var matrix = new SparseMatrix(size);
for (var i = 0; i < size; i++) for (var i = 0; i < size; i++)
@ -139,14 +143,14 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// Create preconditioner (internal) /// Create preconditioner (internal)
/// </summary> /// </summary>
/// <returns>Ilutp instance.</returns> /// <returns>Ilutp instance.</returns>
private ILUTPPreconditioner InternalCreatePreconditioner() ILUTPPreconditioner InternalCreatePreconditioner()
{ {
var result = new ILUTPPreconditioner var result = new ILUTPPreconditioner
{ {
DropTolerance = _dropTolerance, DropTolerance = _dropTolerance,
FillLevel = _fillLevel, FillLevel = _fillLevel,
PivotTolerance = _pivotTolerance PivotTolerance = _pivotTolerance
}; };
return result; return result;
} }
@ -171,7 +175,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<Complex32> preconditioner, SparseMatrix matrix, Vector<Complex32> vector, Vector<Complex32> result) protected override void CheckResult(IPreconditioner<Complex32> preconditioner, SparseMatrix matrix, Vector<Complex32> vector, Vector<Complex32> result)
{ {
Assert.AreEqual(typeof(ILUTPPreconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (ILUTPPreconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal
@ -244,11 +248,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
sparseMatrix[2, 1] = 8; sparseMatrix[2, 1] = 8;
sparseMatrix[2, 2] = 9; sparseMatrix[2, 2] = 9;
var ilu = new ILUTPPreconditioner var ilu = new ILUTPPreconditioner
{ {
PivotTolerance = 0.0, PivotTolerance = 0.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
ilu.Initialize(sparseMatrix); ilu.Initialize(sparseMatrix);
var l = GetLowerTriangle(ilu); var l = GetLowerTriangle(ilu);
@ -300,11 +304,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
sparseMatrix[2, 1] = 8; sparseMatrix[2, 1] = 8;
sparseMatrix[2, 2] = 9; sparseMatrix[2, 2] = 9;
var ilu = new ILUTPPreconditioner var ilu = new ILUTPPreconditioner
{ {
PivotTolerance = 1.0, PivotTolerance = 1.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
ilu.Initialize(sparseMatrix); ilu.Initialize(sparseMatrix);
var l = GetLowerTriangle(ilu); var l = GetLowerTriangle(ilu);
var u = GetUpperTriangle(ilu); var u = GetUpperTriangle(ilu);
@ -337,11 +341,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
var newMatrix = CreateReverseUnitMatrix(Size); var newMatrix = CreateReverseUnitMatrix(Size);
var vector = CreateStandardBcVector(Size); var vector = CreateStandardBcVector(Size);
var preconditioner = new ILUTPPreconditioner var preconditioner = new ILUTPPreconditioner
{ {
PivotTolerance = 1.0, PivotTolerance = 1.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
preconditioner.Initialize(newMatrix); preconditioner.Initialize(newMatrix);
var result = new DenseVector(vector.Count); var result = new DenseVector(vector.Count);
preconditioner.Approximate(vector, result); preconditioner.Approximate(vector, result);

18
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/IncompleteLUTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -28,7 +32,7 @@ using System;
using System.Reflection; using System.Reflection;
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Complex32; using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -49,7 +53,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <param name="methodName">Method name.</param> /// <param name="methodName">Method name.</param>
/// <returns>Result of the method invocation.</returns> /// <returns>Result of the method invocation.</returns>
private static T GetMethod<T>(ILU0Preconditioner ilu, string methodName) static T GetMethod<T>(ILU0Preconditioner ilu, string methodName)
{ {
var type = ilu.GetType(); var type = ilu.GetType();
var methodInfo = type.GetMethod( var methodInfo = type.GetMethod(
@ -60,7 +64,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
new Type[0], new Type[0],
null); null);
var obj = methodInfo.Invoke(ilu, null); var obj = methodInfo.Invoke(ilu, null);
return (T)obj; return (T) obj;
} }
/// <summary> /// <summary>
@ -68,7 +72,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// </summary> /// </summary>
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <returns>Upper triangle.</returns> /// <returns>Upper triangle.</returns>
private static Matrix<Complex32> GetUpperTriangle(ILU0Preconditioner ilu) static Matrix<Complex32> GetUpperTriangle(ILU0Preconditioner ilu)
{ {
return GetMethod<Matrix<Complex32>>(ilu, "UpperTriangle"); return GetMethod<Matrix<Complex32>>(ilu, "UpperTriangle");
} }
@ -78,7 +82,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// </summary> /// </summary>
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <returns>Lower triangle.</returns> /// <returns>Lower triangle.</returns>
private static Matrix<Complex32> GetLowerTriangle(ILU0Preconditioner ilu) static Matrix<Complex32> GetLowerTriangle(ILU0Preconditioner ilu)
{ {
return GetMethod<Matrix<Complex32>>(ilu, "LowerTriangle"); return GetMethod<Matrix<Complex32>>(ilu, "LowerTriangle");
} }
@ -101,7 +105,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.Precon
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<Complex32> preconditioner, SparseMatrix matrix, Vector<Complex32> vector, Vector<Complex32> result) protected override void CheckResult(IPreconditioner<Complex32> preconditioner, SparseMatrix matrix, Vector<Complex32> vector, Vector<Complex32> result)
{ {
Assert.AreEqual(typeof(ILU0Preconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (ILU0Preconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal

6
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/PreConditionerTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND

6
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/Preconditioners/UnitPreconditionerTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND

2
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/StopCriterium/DivergenceStopCriteriumTest.cs

@ -30,7 +30,7 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex32; using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

2
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/StopCriterium/FailureStopCriteriumTest.cs

@ -30,7 +30,7 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex32; using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

2
src/UnitTests/LinearAlgebraTests/Complex32/Solvers/StopCriterium/ResidualStopCriteriumTest.cs

@ -30,7 +30,7 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Complex32; using MathNet.Numerics.LinearAlgebra.Complex32;
using MathNet.Numerics.LinearAlgebra.Complex32.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Complex32.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Double/Solvers/Iterative/BiCgStabTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Double/Solvers/Iterative/GpBiCgTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Double/Solvers/Iterative/MlkBiCgStabTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Double/Solvers/Iterative/TFQMRTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

34
src/UnitTests/LinearAlgebraTests/Double/Solvers/IteratorTest.cs

@ -31,7 +31,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -64,12 +64,12 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers
public void DetermineStatusWithNegativeIterationNumberThrowsArgumentOutOfRangeException() public void DetermineStatusWithNegativeIterationNumberThrowsArgumentOutOfRangeException()
{ {
var criteria = new List<IIterationStopCriterium<double>> var criteria = new List<IIterationStopCriterium<double>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<double>(), new IterationCountStopCriterium<double>(),
new ResidualStopCriterium() new ResidualStopCriterium()
}; };
var iterator = new Iterator<double>(criteria); var iterator = new Iterator<double>(criteria);
Assert.Throws<ArgumentOutOfRangeException>(() => iterator.DetermineStatus( Assert.Throws<ArgumentOutOfRangeException>(() => iterator.DetermineStatus(
@ -86,11 +86,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers
public void DetermineStatus() public void DetermineStatus()
{ {
var criteria = new List<IIterationStopCriterium<double>> var criteria = new List<IIterationStopCriterium<double>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<double>(1) new IterationCountStopCriterium<double>(1)
}; };
var iterator = new Iterator<double>(criteria); var iterator = new Iterator<double>(criteria);
@ -118,11 +118,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers
public void ResetToPrecalculationState() public void ResetToPrecalculationState()
{ {
var criteria = new List<IIterationStopCriterium<double>> var criteria = new List<IIterationStopCriterium<double>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<double>(1) new IterationCountStopCriterium<double>(1)
}; };
var iterator = new Iterator<double>(criteria); var iterator = new Iterator<double>(criteria);

10
src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/DiagonalTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -26,7 +30,7 @@
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -56,7 +60,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<double> preconditioner, SparseMatrix matrix, Vector<double> vector, Vector<double> result) protected override void CheckResult(IPreconditioner<double> preconditioner, SparseMatrix matrix, Vector<double> vector, Vector<double> result)
{ {
Assert.AreEqual(typeof(DiagonalPreconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (DiagonalPreconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal

30
src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/IluptElementSorterTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -24,12 +28,12 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// </copyright> // </copyright>
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using NUnit.Framework;
namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Preconditioners namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Preconditioners
{ {
using LinearAlgebra.Double;
using LinearAlgebra.Double.Solvers.Preconditioners;
using NUnit.Framework;
/// <summary> /// <summary>
/// Test for element sort algorithm of Ilupt class. /// Test for element sort algorithm of Ilupt class.
/// </summary> /// </summary>
@ -42,7 +46,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
[Test] [Test]
public void HeapSortWithIncreasingIntegerArray() public void HeapSortWithIncreasingIntegerArray()
{ {
var sortedIndices = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var sortedIndices = new[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -56,7 +60,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
[Test] [Test]
public void HeapSortWithDecreasingIntegerArray() public void HeapSortWithDecreasingIntegerArray()
{ {
var sortedIndices = new[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; var sortedIndices = new[] {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -70,7 +74,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
[Test] [Test]
public void HeapSortWithRandomIntegerArray() public void HeapSortWithRandomIntegerArray()
{ {
var sortedIndices = new[] { 5, 2, 8, 6, 0, 4, 1, 7, 3, 9 }; var sortedIndices = new[] {5, 2, 8, 6, 0, 4, 1, 7, 3, 9};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -84,7 +88,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
[Test] [Test]
public void HeapSortWithDuplicateEntries() public void HeapSortWithDuplicateEntries()
{ {
var sortedIndices = new[] { 1, 1, 1, 1, 2, 2, 2, 2, 3, 4 }; var sortedIndices = new[] {1, 1, 1, 1, 2, 2, 2, 2, 3, 4};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -125,7 +129,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
[Test] [Test]
public void HeapSortWithSpecialConstructedIntegerArray() public void HeapSortWithSpecialConstructedIntegerArray()
{ {
var sortedIndices = new[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }; var sortedIndices = new[] {0, 0, 0, 0, 0, 1, 0, 0, 0, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -136,7 +140,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
} }
} }
sortedIndices = new[] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; sortedIndices = new[] {1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -147,7 +151,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
} }
} }
sortedIndices = new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; sortedIndices = new[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -158,7 +162,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
} }
} }
sortedIndices = new[] { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 }; sortedIndices = new[] {1, 1, 1, 0, 1, 1, 1, 1, 1, 1};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {

70
src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/IlutpTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -28,7 +32,7 @@ using System;
using System.Reflection; using System.Reflection;
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -43,17 +47,17 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// <summary> /// <summary>
/// The drop tolerance. /// The drop tolerance.
/// </summary> /// </summary>
private double _dropTolerance = 0.1; double _dropTolerance = 0.1;
/// <summary> /// <summary>
/// The fill level. /// The fill level.
/// </summary> /// </summary>
private double _fillLevel = 1.0; double _fillLevel = 1.0;
/// <summary> /// <summary>
/// The pivot tolerance. /// The pivot tolerance.
/// </summary> /// </summary>
private double _pivotTolerance = 1.0; double _pivotTolerance = 1.0;
/// <summary> /// <summary>
/// Setup default parameters. /// Setup default parameters.
@ -73,7 +77,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <param name="methodName">Method name.</param> /// <param name="methodName">Method name.</param>
/// <returns>Result of the method invocation.</returns> /// <returns>Result of the method invocation.</returns>
private static T GetMethod<T>(ILUTPPreconditioner ilutp, string methodName) static T GetMethod<T>(ILUTPPreconditioner ilutp, string methodName)
{ {
var type = ilutp.GetType(); var type = ilutp.GetType();
var methodInfo = type.GetMethod( var methodInfo = type.GetMethod(
@ -84,7 +88,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
new Type[0], new Type[0],
null); null);
var obj = methodInfo.Invoke(ilutp, null); var obj = methodInfo.Invoke(ilutp, null);
return (T)obj; return (T) obj;
} }
/// <summary> /// <summary>
@ -92,7 +96,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Upper triangle.</returns> /// <returns>Upper triangle.</returns>
private static SparseMatrix GetUpperTriangle(ILUTPPreconditioner ilutp) static SparseMatrix GetUpperTriangle(ILUTPPreconditioner ilutp)
{ {
return GetMethod<SparseMatrix>(ilutp, "UpperTriangle"); return GetMethod<SparseMatrix>(ilutp, "UpperTriangle");
} }
@ -102,7 +106,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Lower triangle.</returns> /// <returns>Lower triangle.</returns>
private static SparseMatrix GetLowerTriangle(ILUTPPreconditioner ilutp) static SparseMatrix GetLowerTriangle(ILUTPPreconditioner ilutp)
{ {
return GetMethod<SparseMatrix>(ilutp, "LowerTriangle"); return GetMethod<SparseMatrix>(ilutp, "LowerTriangle");
} }
@ -112,7 +116,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Pivots array.</returns> /// <returns>Pivots array.</returns>
private static int[] GetPivots(ILUTPPreconditioner ilutp) static int[] GetPivots(ILUTPPreconditioner ilutp)
{ {
return GetMethod<int[]>(ilutp, "Pivots"); return GetMethod<int[]>(ilutp, "Pivots");
} }
@ -122,7 +126,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="size">Matrix order.</param> /// <param name="size">Matrix order.</param>
/// <returns>Reverse Unit matrix.</returns> /// <returns>Reverse Unit matrix.</returns>
private static SparseMatrix CreateReverseUnitMatrix(int size) static SparseMatrix CreateReverseUnitMatrix(int size)
{ {
var matrix = new SparseMatrix(size); var matrix = new SparseMatrix(size);
for (var i = 0; i < size; i++) for (var i = 0; i < size; i++)
@ -137,14 +141,14 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// Create preconditioner (internal) /// Create preconditioner (internal)
/// </summary> /// </summary>
/// <returns>Ilutp instance.</returns> /// <returns>Ilutp instance.</returns>
private ILUTPPreconditioner InternalCreatePreconditioner() ILUTPPreconditioner InternalCreatePreconditioner()
{ {
var result = new ILUTPPreconditioner var result = new ILUTPPreconditioner
{ {
DropTolerance = _dropTolerance, DropTolerance = _dropTolerance,
FillLevel = _fillLevel, FillLevel = _fillLevel,
PivotTolerance = _pivotTolerance PivotTolerance = _pivotTolerance
}; };
return result; return result;
} }
@ -169,7 +173,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<double> preconditioner, SparseMatrix matrix, Vector<double> vector, Vector<double> result) protected override void CheckResult(IPreconditioner<double> preconditioner, SparseMatrix matrix, Vector<double> vector, Vector<double> result)
{ {
Assert.AreEqual(typeof(ILUTPPreconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (ILUTPPreconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal
@ -241,11 +245,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
sparseMatrix[2, 1] = 8; sparseMatrix[2, 1] = 8;
sparseMatrix[2, 2] = 9; sparseMatrix[2, 2] = 9;
var ilu = new ILUTPPreconditioner var ilu = new ILUTPPreconditioner
{ {
PivotTolerance = 0.0, PivotTolerance = 0.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
ilu.Initialize(sparseMatrix); ilu.Initialize(sparseMatrix);
var l = GetLowerTriangle(ilu); var l = GetLowerTriangle(ilu);
@ -296,11 +300,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
sparseMatrix[2, 1] = 8; sparseMatrix[2, 1] = 8;
sparseMatrix[2, 2] = 9; sparseMatrix[2, 2] = 9;
var ilu = new ILUTPPreconditioner var ilu = new ILUTPPreconditioner
{ {
PivotTolerance = 1.0, PivotTolerance = 1.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
ilu.Initialize(sparseMatrix); ilu.Initialize(sparseMatrix);
var l = GetLowerTriangle(ilu); var l = GetLowerTriangle(ilu);
var u = GetUpperTriangle(ilu); var u = GetUpperTriangle(ilu);
@ -332,11 +336,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
var newMatrix = CreateReverseUnitMatrix(Size); var newMatrix = CreateReverseUnitMatrix(Size);
var vector = CreateStandardBcVector(Size); var vector = CreateStandardBcVector(Size);
var preconditioner = new ILUTPPreconditioner var preconditioner = new ILUTPPreconditioner
{ {
PivotTolerance = 1.0, PivotTolerance = 1.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
preconditioner.Initialize(newMatrix); preconditioner.Initialize(newMatrix);
var result = new DenseVector(vector.Count); var result = new DenseVector(vector.Count);
preconditioner.Approximate(vector, result); preconditioner.Approximate(vector, result);

18
src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/IncompleteLUTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -28,7 +32,7 @@ using System;
using System.Reflection; using System.Reflection;
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -47,7 +51,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <param name="methodName">Method name.</param> /// <param name="methodName">Method name.</param>
/// <returns>Result of the method invocation.</returns> /// <returns>Result of the method invocation.</returns>
private static T GetMethod<T>(ILU0Preconditioner ilu, string methodName) static T GetMethod<T>(ILU0Preconditioner ilu, string methodName)
{ {
var type = ilu.GetType(); var type = ilu.GetType();
var methodInfo = type.GetMethod( var methodInfo = type.GetMethod(
@ -58,7 +62,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
new Type[0], new Type[0],
null); null);
var obj = methodInfo.Invoke(ilu, null); var obj = methodInfo.Invoke(ilu, null);
return (T)obj; return (T) obj;
} }
/// <summary> /// <summary>
@ -66,7 +70,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <returns>Upper triangle.</returns> /// <returns>Upper triangle.</returns>
private static Matrix<double> GetUpperTriangle(ILU0Preconditioner ilu) static Matrix<double> GetUpperTriangle(ILU0Preconditioner ilu)
{ {
return GetMethod<Matrix<double>>(ilu, "UpperTriangle"); return GetMethod<Matrix<double>>(ilu, "UpperTriangle");
} }
@ -76,7 +80,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <returns>Lower triangle.</returns> /// <returns>Lower triangle.</returns>
private static Matrix<double> GetLowerTriangle(ILU0Preconditioner ilu) static Matrix<double> GetLowerTriangle(ILU0Preconditioner ilu)
{ {
return GetMethod<Matrix<double>>(ilu, "LowerTriangle"); return GetMethod<Matrix<double>>(ilu, "LowerTriangle");
} }
@ -99,7 +103,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<double> preconditioner, SparseMatrix matrix, Vector<double> vector, Vector<double> result) protected override void CheckResult(IPreconditioner<double> preconditioner, SparseMatrix matrix, Vector<double> vector, Vector<double> result)
{ {
Assert.AreEqual(typeof(ILU0Preconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (ILU0Preconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal

6
src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/PreConditionerTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND

3
src/UnitTests/LinearAlgebraTests/Double/Solvers/Preconditioners/UnitPreconditionerTest.cs

@ -26,7 +26,6 @@
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -56,7 +55,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.Precondit
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<double> preconditioner, SparseMatrix matrix, Vector<double> vector, Vector<double> result) protected override void CheckResult(IPreconditioner<double> preconditioner, SparseMatrix matrix, Vector<double> vector, Vector<double> result)
{ {
Assert.AreEqual(typeof(UnitPreconditioner<double>), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (UnitPreconditioner<double>), preconditioner.GetType(), "#01");
// Unit preconditioner is doing nothing. Vector and result should be equal // Unit preconditioner is doing nothing. Vector and result should be equal
for (var i = 0; i < vector.Count; i++) for (var i = 0; i < vector.Count; i++)

2
src/UnitTests/LinearAlgebraTests/Double/Solvers/StopCriterium/DivergenceStopCriteriumTest.cs

@ -30,7 +30,7 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

30
src/UnitTests/LinearAlgebraTests/Double/Solvers/StopCriterium/FailureStopCriteriumTest.cs

@ -28,11 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// </copyright> // </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
using System;
namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.StopCriterium namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.StopCriterium
{ {
@ -85,9 +85,9 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.StopCrite
var criterium = new FailureStopCriterium(); var criterium = new FailureStopCriterium();
Assert.IsNotNull(criterium, "There should be a criterium"); Assert.IsNotNull(criterium, "There should be a criterium");
var solution = new DenseVector(new[] { 1.0, 1.0, 2.0 }); var solution = new DenseVector(new[] {1.0, 1.0, 2.0});
var source = new DenseVector(new[] { 1001.0, 0, 2003.0 }); var source = new DenseVector(new[] {1001.0, 0, 2003.0});
var residual = new DenseVector(new[] { 1000, double.NaN, 2001 }); var residual = new DenseVector(new[] {1000, double.NaN, 2001});
var status = criterium.DetermineStatus(5, solution, source, residual); var status = criterium.DetermineStatus(5, solution, source, residual);
Assert.AreEqual(IterationStatus.Failure, status, "Should be failed"); Assert.AreEqual(IterationStatus.Failure, status, "Should be failed");
@ -102,9 +102,9 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.StopCrite
var criterium = new FailureStopCriterium(); var criterium = new FailureStopCriterium();
Assert.IsNotNull(criterium, "There should be a criterium"); Assert.IsNotNull(criterium, "There should be a criterium");
var solution = new DenseVector(new[] { 1.0, 1.0, double.NaN }); var solution = new DenseVector(new[] {1.0, 1.0, double.NaN});
var source = new DenseVector(new[] { 1001.0, 0.0, 2003.0 }); var source = new DenseVector(new[] {1001.0, 0.0, 2003.0});
var residual = new DenseVector(new[] { 1000.0, 1000.0, 2001.0 }); var residual = new DenseVector(new[] {1000.0, 1000.0, 2001.0});
var status = criterium.DetermineStatus(5, solution, source, residual); var status = criterium.DetermineStatus(5, solution, source, residual);
Assert.AreEqual(IterationStatus.Failure, status, "Should be failed"); Assert.AreEqual(IterationStatus.Failure, status, "Should be failed");
@ -119,9 +119,9 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.StopCrite
var criterium = new FailureStopCriterium(); var criterium = new FailureStopCriterium();
Assert.IsNotNull(criterium, "There should be a criterium"); Assert.IsNotNull(criterium, "There should be a criterium");
var solution = new DenseVector(new[] { 3.0, 2.0, 1.0 }); var solution = new DenseVector(new[] {3.0, 2.0, 1.0});
var source = new DenseVector(new[] { 1001.0, 0.0, 2003.0 }); var source = new DenseVector(new[] {1001.0, 0.0, 2003.0});
var residual = new DenseVector(new[] { 1.0, 2.0, 3.0 }); var residual = new DenseVector(new[] {1.0, 2.0, 3.0});
var status = criterium.DetermineStatus(5, solution, source, residual); var status = criterium.DetermineStatus(5, solution, source, residual);
Assert.AreEqual(IterationStatus.Continue, status, "Should be running"); Assert.AreEqual(IterationStatus.Continue, status, "Should be running");
@ -136,9 +136,9 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.StopCrite
var criterium = new FailureStopCriterium(); var criterium = new FailureStopCriterium();
Assert.IsNotNull(criterium, "There should be a criterium"); Assert.IsNotNull(criterium, "There should be a criterium");
var solution = new DenseVector(new[] { 1.0, 1.0, 2.0 }); var solution = new DenseVector(new[] {1.0, 1.0, 2.0});
var source = new DenseVector(new[] { 1001.0, 0.0, 2003.0 }); var source = new DenseVector(new[] {1001.0, 0.0, 2003.0});
var residual = new DenseVector(new[] { 1000.0, 1000.0, 2001.0 }); var residual = new DenseVector(new[] {1000.0, 1000.0, 2001.0});
var status = criterium.DetermineStatus(5, solution, source, residual); var status = criterium.DetermineStatus(5, solution, source, residual);
Assert.AreEqual(IterationStatus.Continue, status, "Should be running"); Assert.AreEqual(IterationStatus.Continue, status, "Should be running");
@ -156,7 +156,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Solvers.StopCrite
var criterium = new FailureStopCriterium(); var criterium = new FailureStopCriterium();
Assert.IsNotNull(criterium, "There should be a criterium"); Assert.IsNotNull(criterium, "There should be a criterium");
var clone = criterium.Clone(); var clone = criterium.Clone();
Assert.IsInstanceOf(typeof(FailureStopCriterium), clone, "Wrong criterium type"); Assert.IsInstanceOf(typeof (FailureStopCriterium), clone, "Wrong criterium type");
} }
} }
} }

2
src/UnitTests/LinearAlgebraTests/Double/Solvers/StopCriterium/ResidualStopCriteriumTest.cs

@ -30,7 +30,7 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Double.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Double.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Single/Solvers/Iterative/BiCgStabTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers; using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Single/Solvers/Iterative/GpBiCgTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers; using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Single/Solvers/Iterative/MlkBiCgStabTest.cs

@ -32,7 +32,6 @@ using System;
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers; using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

1
src/UnitTests/LinearAlgebraTests/Single/Solvers/Iterative/TFQMRTest.cs

@ -31,7 +31,6 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers; using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

34
src/UnitTests/LinearAlgebraTests/Single/Solvers/IteratorTest.cs

@ -31,7 +31,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -64,12 +64,12 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers
public void DetermineStatusWithNegativeIterationNumberThrowsArgumentOutOfRangeException() public void DetermineStatusWithNegativeIterationNumberThrowsArgumentOutOfRangeException()
{ {
var criteria = new List<IIterationStopCriterium<float>> var criteria = new List<IIterationStopCriterium<float>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<float>(), new IterationCountStopCriterium<float>(),
new ResidualStopCriterium() new ResidualStopCriterium()
}; };
var iterator = new Iterator<float>(criteria); var iterator = new Iterator<float>(criteria);
Assert.Throws<ArgumentOutOfRangeException>(() => iterator.DetermineStatus( Assert.Throws<ArgumentOutOfRangeException>(() => iterator.DetermineStatus(
@ -86,11 +86,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers
public void DetermineStatus() public void DetermineStatus()
{ {
var criteria = new List<IIterationStopCriterium<float>> var criteria = new List<IIterationStopCriterium<float>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<float>(1) new IterationCountStopCriterium<float>(1)
}; };
var iterator = new Iterator<float>(criteria); var iterator = new Iterator<float>(criteria);
@ -118,11 +118,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers
public void ResetToPrecalculationState() public void ResetToPrecalculationState()
{ {
var criteria = new List<IIterationStopCriterium<float>> var criteria = new List<IIterationStopCriterium<float>>
{ {
new FailureStopCriterium(), new FailureStopCriterium(),
new DivergenceStopCriterium(), new DivergenceStopCriterium(),
new IterationCountStopCriterium<float>(1) new IterationCountStopCriterium<float>(1)
}; };
var iterator = new Iterator<float>(criteria); var iterator = new Iterator<float>(criteria);

12
src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/DiagonalTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -26,7 +30,7 @@
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -56,7 +60,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<float> preconditioner, SparseMatrix matrix, Vector<float> vector, Vector<float> result) protected override void CheckResult(IPreconditioner<float> preconditioner, SparseMatrix matrix, Vector<float> vector, Vector<float> result)
{ {
Assert.AreEqual(typeof(DiagonalPreconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (DiagonalPreconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal
@ -65,7 +69,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
for (var i = 0; i < product.Count; i++) for (var i = 0; i < product.Count; i++)
{ {
Assert.IsTrue(((double)vector[i]).AlmostEqual(product[i], -Epsilon.Magnitude()), "#02-" + i); Assert.IsTrue(((double) vector[i]).AlmostEqual(product[i], -Epsilon.Magnitude()), "#02-" + i);
} }
} }
} }

30
src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/IluptElementSorterTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -24,12 +28,12 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// </copyright> // </copyright>
using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using NUnit.Framework;
namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Preconditioners namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Preconditioners
{ {
using LinearAlgebra.Single;
using LinearAlgebra.Single.Solvers.Preconditioners;
using NUnit.Framework;
/// <summary> /// <summary>
/// Test for element sort algorithm of Ilupt class. /// Test for element sort algorithm of Ilupt class.
/// </summary> /// </summary>
@ -42,7 +46,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
[Test] [Test]
public void HeapSortWithIncreasingIntegerArray() public void HeapSortWithIncreasingIntegerArray()
{ {
var sortedIndices = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var sortedIndices = new[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -56,7 +60,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
[Test] [Test]
public void HeapSortWithDecreasingIntegerArray() public void HeapSortWithDecreasingIntegerArray()
{ {
var sortedIndices = new[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; var sortedIndices = new[] {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -70,7 +74,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
[Test] [Test]
public void HeapSortWithRandomIntegerArray() public void HeapSortWithRandomIntegerArray()
{ {
var sortedIndices = new[] { 5, 2, 8, 6, 0, 4, 1, 7, 3, 9 }; var sortedIndices = new[] {5, 2, 8, 6, 0, 4, 1, 7, 3, 9};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -84,7 +88,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
[Test] [Test]
public void HeapSortWithDuplicateEntries() public void HeapSortWithDuplicateEntries()
{ {
var sortedIndices = new[] { 1, 1, 1, 1, 2, 2, 2, 2, 3, 4 }; var sortedIndices = new[] {1, 1, 1, 1, 2, 2, 2, 2, 3, 4};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -125,7 +129,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
[Test] [Test]
public void HeapSortWithSpecialConstructedIntegerArray() public void HeapSortWithSpecialConstructedIntegerArray()
{ {
var sortedIndices = new[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }; var sortedIndices = new[] {0, 0, 0, 0, 0, 1, 0, 0, 0, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -136,7 +140,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
} }
} }
sortedIndices = new[] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; sortedIndices = new[] {1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -147,7 +151,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
} }
} }
sortedIndices = new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; sortedIndices = new[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {
@ -158,7 +162,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
} }
} }
sortedIndices = new[] { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 }; sortedIndices = new[] {1, 1, 1, 0, 1, 1, 1, 1, 1, 1};
ILUTPElementSorter.SortIntegersDecreasing(sortedIndices); ILUTPElementSorter.SortIntegersDecreasing(sortedIndices);
for (var i = 0; i < sortedIndices.Length; i++) for (var i = 0; i < sortedIndices.Length; i++)
{ {

76
src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/IlutpTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -28,7 +32,7 @@ using System;
using System.Reflection; using System.Reflection;
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -43,17 +47,17 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// <summary> /// <summary>
/// The drop tolerance. /// The drop tolerance.
/// </summary> /// </summary>
private double _dropTolerance = 0.1; double _dropTolerance = 0.1;
/// <summary> /// <summary>
/// The fill level. /// The fill level.
/// </summary> /// </summary>
private double _fillLevel = 1.0; double _fillLevel = 1.0;
/// <summary> /// <summary>
/// The pivot tolerance. /// The pivot tolerance.
/// </summary> /// </summary>
private double _pivotTolerance = 1.0; double _pivotTolerance = 1.0;
/// <summary> /// <summary>
/// Setup default parameters. /// Setup default parameters.
@ -73,7 +77,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <param name="methodName">Method name.</param> /// <param name="methodName">Method name.</param>
/// <returns>Result of the method invocation.</returns> /// <returns>Result of the method invocation.</returns>
private static T GetMethod<T>(ILUTPPreconditioner ilutp, string methodName) static T GetMethod<T>(ILUTPPreconditioner ilutp, string methodName)
{ {
var type = ilutp.GetType(); var type = ilutp.GetType();
var methodInfo = type.GetMethod( var methodInfo = type.GetMethod(
@ -84,7 +88,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
new Type[0], new Type[0],
null); null);
var obj = methodInfo.Invoke(ilutp, null); var obj = methodInfo.Invoke(ilutp, null);
return (T)obj; return (T) obj;
} }
/// <summary> /// <summary>
@ -92,7 +96,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Upper triangle.</returns> /// <returns>Upper triangle.</returns>
private static SparseMatrix GetUpperTriangle(ILUTPPreconditioner ilutp) static SparseMatrix GetUpperTriangle(ILUTPPreconditioner ilutp)
{ {
return GetMethod<SparseMatrix>(ilutp, "UpperTriangle"); return GetMethod<SparseMatrix>(ilutp, "UpperTriangle");
} }
@ -102,7 +106,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Lower triangle.</returns> /// <returns>Lower triangle.</returns>
private static SparseMatrix GetLowerTriangle(ILUTPPreconditioner ilutp) static SparseMatrix GetLowerTriangle(ILUTPPreconditioner ilutp)
{ {
return GetMethod<SparseMatrix>(ilutp, "LowerTriangle"); return GetMethod<SparseMatrix>(ilutp, "LowerTriangle");
} }
@ -112,7 +116,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="ilutp">Ilutp instance.</param> /// <param name="ilutp">Ilutp instance.</param>
/// <returns>Pivots array.</returns> /// <returns>Pivots array.</returns>
private static int[] GetPivots(ILUTPPreconditioner ilutp) static int[] GetPivots(ILUTPPreconditioner ilutp)
{ {
return GetMethod<int[]>(ilutp, "Pivots"); return GetMethod<int[]>(ilutp, "Pivots");
} }
@ -122,7 +126,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="size">Matrix order.</param> /// <param name="size">Matrix order.</param>
/// <returns>Reverse Unit matrix.</returns> /// <returns>Reverse Unit matrix.</returns>
private static SparseMatrix CreateReverseUnitMatrix(int size) static SparseMatrix CreateReverseUnitMatrix(int size)
{ {
var matrix = new SparseMatrix(size); var matrix = new SparseMatrix(size);
for (var i = 0; i < size; i++) for (var i = 0; i < size; i++)
@ -137,14 +141,14 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// Create preconditioner (internal) /// Create preconditioner (internal)
/// </summary> /// </summary>
/// <returns>Ilutp instance.</returns> /// <returns>Ilutp instance.</returns>
private ILUTPPreconditioner InternalCreatePreconditioner() ILUTPPreconditioner InternalCreatePreconditioner()
{ {
var result = new ILUTPPreconditioner var result = new ILUTPPreconditioner
{ {
DropTolerance = _dropTolerance, DropTolerance = _dropTolerance,
FillLevel = _fillLevel, FillLevel = _fillLevel,
PivotTolerance = _pivotTolerance PivotTolerance = _pivotTolerance
}; };
return result; return result;
} }
@ -169,7 +173,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<float> preconditioner, SparseMatrix matrix, Vector<float> vector, Vector<float> result) protected override void CheckResult(IPreconditioner<float> preconditioner, SparseMatrix matrix, Vector<float> vector, Vector<float> result)
{ {
Assert.AreEqual(typeof(ILUTPPreconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (ILUTPPreconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal
@ -177,7 +181,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
matrix.Multiply(result, product); matrix.Multiply(result, product);
for (var i = 0; i < product.Count; i++) for (var i = 0; i < product.Count; i++)
{ {
Assert.IsTrue(((double)vector[i]).AlmostEqual(product[i], -Epsilon.Magnitude()), "#02-" + i); Assert.IsTrue(((double) vector[i]).AlmostEqual(product[i], -Epsilon.Magnitude()), "#02-" + i);
} }
} }
@ -241,11 +245,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
sparseMatrix[2, 1] = 8; sparseMatrix[2, 1] = 8;
sparseMatrix[2, 2] = 9; sparseMatrix[2, 2] = 9;
var ilu = new ILUTPPreconditioner var ilu = new ILUTPPreconditioner
{ {
PivotTolerance = 0.0, PivotTolerance = 0.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
ilu.Initialize(sparseMatrix); ilu.Initialize(sparseMatrix);
var l = GetLowerTriangle(ilu); var l = GetLowerTriangle(ilu);
@ -274,7 +278,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
{ {
for (var j = 0; j < sparseMatrix.ColumnCount; j++) for (var j = 0; j < sparseMatrix.ColumnCount; j++)
{ {
Assert.IsTrue(((double)sparseMatrix[i, j]).AlmostEqualInDecimalPlaces(original[i, j], 5), "#03-" + i + "-" + j); Assert.IsTrue(((double) sparseMatrix[i, j]).AlmostEqualInDecimalPlaces(original[i, j], 5), "#03-" + i + "-" + j);
} }
} }
} }
@ -296,11 +300,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
sparseMatrix[2, 1] = 8; sparseMatrix[2, 1] = 8;
sparseMatrix[2, 2] = 9; sparseMatrix[2, 2] = 9;
var ilu = new ILUTPPreconditioner var ilu = new ILUTPPreconditioner
{ {
PivotTolerance = 1.0, PivotTolerance = 1.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
ilu.Initialize(sparseMatrix); ilu.Initialize(sparseMatrix);
var l = GetLowerTriangle(ilu); var l = GetLowerTriangle(ilu);
var u = GetUpperTriangle(ilu); var u = GetUpperTriangle(ilu);
@ -317,7 +321,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
{ {
for (var j = 0; j < sparseMatrix.ColumnCount; j++) for (var j = 0; j < sparseMatrix.ColumnCount; j++)
{ {
Assert.IsTrue(((double)sparseMatrix[i, j]).AlmostEqual(original[i, j], -Epsilon.Magnitude()), "#01-" + i + "-" + j); Assert.IsTrue(((double) sparseMatrix[i, j]).AlmostEqual(original[i, j], -Epsilon.Magnitude()), "#01-" + i + "-" + j);
} }
} }
} }
@ -332,11 +336,11 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
var newMatrix = CreateReverseUnitMatrix(Size); var newMatrix = CreateReverseUnitMatrix(Size);
var vector = CreateStandardBcVector(Size); var vector = CreateStandardBcVector(Size);
var preconditioner = new ILUTPPreconditioner var preconditioner = new ILUTPPreconditioner
{ {
PivotTolerance = 1.0, PivotTolerance = 1.0,
DropTolerance = 0, DropTolerance = 0,
FillLevel = 10 FillLevel = 10
}; };
preconditioner.Initialize(newMatrix); preconditioner.Initialize(newMatrix);
var result = new DenseVector(vector.Count); var result = new DenseVector(vector.Count);
preconditioner.Approximate(vector, result); preconditioner.Approximate(vector, result);

20
src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/IncompleteLUTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -28,7 +32,7 @@ using System;
using System.Reflection; using System.Reflection;
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.Preconditioners; using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -47,7 +51,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <param name="methodName">Method name.</param> /// <param name="methodName">Method name.</param>
/// <returns>Result of the method invocation.</returns> /// <returns>Result of the method invocation.</returns>
private static T GetMethod<T>(ILU0Preconditioner ilu, string methodName) static T GetMethod<T>(ILU0Preconditioner ilu, string methodName)
{ {
var type = ilu.GetType(); var type = ilu.GetType();
var methodInfo = type.GetMethod( var methodInfo = type.GetMethod(
@ -58,7 +62,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
new Type[0], new Type[0],
null); null);
var obj = methodInfo.Invoke(ilu, null); var obj = methodInfo.Invoke(ilu, null);
return (T)obj; return (T) obj;
} }
/// <summary> /// <summary>
@ -66,7 +70,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <returns>Upper triangle.</returns> /// <returns>Upper triangle.</returns>
private static Matrix<float> GetUpperTriangle(ILU0Preconditioner ilu) static Matrix<float> GetUpperTriangle(ILU0Preconditioner ilu)
{ {
return GetMethod<Matrix<float>>(ilu, "UpperTriangle"); return GetMethod<Matrix<float>>(ilu, "UpperTriangle");
} }
@ -76,7 +80,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// </summary> /// </summary>
/// <param name="ilu"><c>IncompleteLU</c> instance.</param> /// <param name="ilu"><c>IncompleteLU</c> instance.</param>
/// <returns>Lower triangle.</returns> /// <returns>Lower triangle.</returns>
private static Matrix<float> GetLowerTriangle(ILU0Preconditioner ilu) static Matrix<float> GetLowerTriangle(ILU0Preconditioner ilu)
{ {
return GetMethod<Matrix<float>>(ilu, "LowerTriangle"); return GetMethod<Matrix<float>>(ilu, "LowerTriangle");
} }
@ -99,7 +103,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<float> preconditioner, SparseMatrix matrix, Vector<float> vector, Vector<float> result) protected override void CheckResult(IPreconditioner<float> preconditioner, SparseMatrix matrix, Vector<float> vector, Vector<float> result)
{ {
Assert.AreEqual(typeof(ILU0Preconditioner), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (ILU0Preconditioner), preconditioner.GetType(), "#01");
// Compute M * result = product // Compute M * result = product
// compare vector and product. Should be equal // compare vector and product. Should be equal
@ -108,7 +112,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
for (var i = 0; i < product.Count; i++) for (var i = 0; i < product.Count; i++)
{ {
Assert.IsTrue(((double)vector[i]).AlmostEqual(product[i], -Epsilon.Magnitude()), "#02-" + i); Assert.IsTrue(((double) vector[i]).AlmostEqual(product[i], -Epsilon.Magnitude()), "#02-" + i);
} }
} }

6
src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/PreConditionerTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND

9
src/UnitTests/LinearAlgebraTests/Single/Solvers/Preconditioners/UnitPreconditionerTest.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // 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 // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without // files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the // copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following // Software is furnished to do so, subject to the following
// conditions: // conditions:
//
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -26,7 +30,6 @@
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.Preconditioners;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
@ -56,7 +59,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.Precondit
/// <param name="result">Result vector.</param> /// <param name="result">Result vector.</param>
protected override void CheckResult(IPreconditioner<float> preconditioner, SparseMatrix matrix, Vector<float> vector, Vector<float> result) protected override void CheckResult(IPreconditioner<float> preconditioner, SparseMatrix matrix, Vector<float> vector, Vector<float> result)
{ {
Assert.AreEqual(typeof(UnitPreconditioner<float>), preconditioner.GetType(), "#01"); Assert.AreEqual(typeof (UnitPreconditioner<float>), preconditioner.GetType(), "#01");
// Unit preconditioner is doing nothing. Vector and result should be equal // Unit preconditioner is doing nothing. Vector and result should be equal
for (var i = 0; i < vector.Count; i++) for (var i = 0; i < vector.Count; i++)

2
src/UnitTests/LinearAlgebraTests/Single/Solvers/StopCriterium/DivergenceStopCriteriumTest.cs

@ -30,7 +30,7 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

4
src/UnitTests/LinearAlgebraTests/Single/Solvers/StopCriterium/FailureStopCriteriumTest.cs

@ -28,11 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// </copyright> // </copyright>
using System;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;
using System;
namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.StopCriterium namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.Solvers.StopCriterium
{ {

2
src/UnitTests/LinearAlgebraTests/Single/Solvers/StopCriterium/ResidualStopCriteriumTest.cs

@ -30,7 +30,7 @@
using System; using System;
using MathNet.Numerics.LinearAlgebra.Single; using MathNet.Numerics.LinearAlgebra.Single;
using MathNet.Numerics.LinearAlgebra.Single.Solvers.StopCriterium; using MathNet.Numerics.LinearAlgebra.Single.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers; using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework; using NUnit.Framework;

Loading…
Cancel
Save