本文整理汇总了C#中MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterator类的典型用法代码示例。如果您正苦于以下问题:C# Iterator类的具体用法?C# Iterator怎么用?C# Iterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Iterator类属于MathNet.Numerics.LinearAlgebra.Double.Solvers命名空间,在下文中一共展示了Iterator类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CanSolveForRandomMatrix
public void CanSolveForRandomMatrix(int order)
{
var matrixA = MatrixLoader.GenerateRandomDenseMatrix(order, order);
var matrixB = MatrixLoader.GenerateRandomDenseMatrix(order, order);
var monitor = new Iterator<double>(new IIterationStopCriterium<double>[]
{
new IterationCountStopCriterium<double>(1000),
new ResidualStopCriterium(1e-10)
});
var solver = new TFQMR(monitor);
var matrixX = solver.Solve(matrixA, matrixB);
// The solution X row dimension is equal to the column dimension of A
Assert.AreEqual(matrixA.ColumnCount, matrixX.RowCount);
// The solution X has the same number of columns as B
Assert.AreEqual(matrixB.ColumnCount, matrixX.ColumnCount);
var matrixBReconstruct = matrixA*matrixX;
// Check the reconstruction.
for (var i = 0; i < matrixB.RowCount; i++)
{
for (var j = 0; j < matrixB.ColumnCount; j++)
{
Assert.AreEqual(matrixB[i, j], matrixBReconstruct[i, j], 1.0e-7);
}
}
}
开发者ID:primebing,项目名称:mathnet-numerics,代码行数:30,代码来源:TFQMRTest.cs
示例2: DetermineStatus
public void DetermineStatus()
{
var criteria = new List<IIterationStopCriterium<double>>
{
new FailureStopCriterium(),
new DivergenceStopCriterium(),
new IterationCountStopCriterium<double>(1)
};
var iterator = new Iterator<double>(criteria);
// First step, nothing should happen.
iterator.DetermineStatus(
0,
DenseVector.Create(3, i => 4),
DenseVector.Create(3, i => 4),
DenseVector.Create(3, i => 4));
Assert.AreEqual(IterationStatus.Continue, iterator.Status, "Incorrect status");
// Second step, should run out of iterations.
iterator.DetermineStatus(
1,
DenseVector.Create(3, i => 4),
DenseVector.Create(3, i => 4),
DenseVector.Create(3, i => 4));
Assert.AreEqual(IterationStatus.StoppedWithoutConvergence, iterator.Status, "Incorrect status");
}
开发者ID:TransientResponse,项目名称:mathnet-numerics,代码行数:27,代码来源:IteratorTest.cs
示例3: CanSolveForRandomMatrix
public void CanSolveForRandomMatrix(int order)
{
var matrixA = Matrix<double>.Build.Random(order, order, 1);
var matrixB = Matrix<double>.Build.Random(order, order, 1);
var monitor = new Iterator<double>(
new IterationCountStopCriterium<double>(1000),
new ResidualStopCriterium<double>(1e-10));
var solver = new GpBiCg();
var matrixX = matrixA.SolveIterative(matrixB, solver, monitor);
// The solution X row dimension is equal to the column dimension of A
Assert.AreEqual(matrixA.ColumnCount, matrixX.RowCount);
// The solution X has the same number of columns as B
Assert.AreEqual(matrixB.ColumnCount, matrixX.ColumnCount);
var matrixBReconstruct = matrixA*matrixX;
// Check the reconstruction.
for (var i = 0; i < matrixB.RowCount; i++)
{
for (var j = 0; j < matrixB.ColumnCount; j++)
{
Assert.AreEqual(matrixB[i, j], matrixBReconstruct[i, j], 1.0e-7);
}
}
}
开发者ID:rmundy,项目名称:mathnet-numerics,代码行数:29,代码来源:GpBiCgTest.cs
示例4: CreateDefault
/// <summary>
/// Creates a default iterator with all the <see cref="IIterationStopCriterium"/> objects.
/// </summary>
/// <returns>A new <see cref="IIterator"/> object.</returns>
public static IIterator CreateDefault()
{
var iterator = new Iterator();
iterator.Add(new FailureStopCriterium());
iterator.Add(new DivergenceStopCriterium());
iterator.Add(new IterationCountStopCriterium());
iterator.Add(new ResidualStopCriterium());
return iterator;
}
开发者ID:koponk,项目名称:mathnet-numerics,代码行数:14,代码来源:Iterator.cs
示例5: ResetToPrecalculationState
public void ResetToPrecalculationState()
{
var criteria = new List<IIterationStopCriterium<double>>
{
new FailureStopCriterium(),
new DivergenceStopCriterium(),
new IterationCountStopCriterium<double>(1)
};
var iterator = new Iterator<double>(criteria);
// First step, nothing should happen.
iterator.DetermineStatus(
0,
DenseVector.Create(3, i => 4),
DenseVector.Create(3, i => 4),
DenseVector.Create(3, i => 4));
Assert.AreEqual(IterationStatus.Continue, iterator.Status, "Incorrect status");
iterator.Reset();
Assert.AreEqual(IterationStatus.Continue, iterator.Status, "Incorrect status");
Assert.AreEqual(IterationStatus.Continue, criteria[0].Status, "Incorrect status");
Assert.AreEqual(IterationStatus.Continue, criteria[1].Status, "Incorrect status");
Assert.AreEqual(IterationStatus.Continue, criteria[2].Status, "Incorrect status");
}
开发者ID:TransientResponse,项目名称:mathnet-numerics,代码行数:25,代码来源:IteratorTest.cs
示例6: DetermineStatusWithoutStopCriteriaDoesNotThrow
public void DetermineStatusWithoutStopCriteriaDoesNotThrow()
{
var iterator = new Iterator<double>();
Assert.DoesNotThrow(() => iterator.DetermineStatus(
0,
DenseVector.Create(3, i => 4),
DenseVector.Create(3, i => 5),
DenseVector.Create(3, i => 6)));
}
开发者ID:TransientResponse,项目名称:mathnet-numerics,代码行数:9,代码来源:IteratorTest.cs
示例7: SolveUnitMatrixAndBackMultiply
public void SolveUnitMatrixAndBackMultiply()
{
// Create the identity matrix
var matrix = Matrix<double>.Build.SparseIdentity(100);
// Create the y vector
var y = Vector<double>.Build.Dense(matrix.RowCount, 1);
// Create an iteration monitor which will keep track of iterative convergence
var monitor = new Iterator<double>(
new IterationCountStopCriterion<double>(MaximumIterations),
new ResidualStopCriterion<double>(ConvergenceBoundary),
new DivergenceStopCriterion<double>(),
new FailureStopCriterion<double>());
var solver = new MlkBiCgStab();
// Solve equation Ax = y
var x = matrix.SolveIterative(y, solver, monitor);
// Now compare the results
Assert.IsNotNull(x, "#02");
Assert.AreEqual(y.Count, x.Count, "#03");
// Back multiply the vector
var z = matrix.Multiply(x);
// Check that the solution converged
Assert.IsTrue(monitor.Status == IterationStatus.Converged, "#04");
// Now compare the vectors
for (var i = 0; i < y.Count; i++)
{
Assert.GreaterOrEqual(ConvergenceBoundary, Math.Abs(y[i] - z[i]), "#05-" + i);
}
}
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:36,代码来源:MlkBiCgStabTest.cs
示例8: CanSolveForRandomVector
public void CanSolveForRandomVector(int order)
{
var matrixA = Matrix<double>.Build.Random(order, order, 1);
var vectorb = Vector<double>.Build.Random(order, 1);
var monitor = new Iterator<double>(
new IterationCountStopCriterion<double>(1000),
new ResidualStopCriterion<double>(1e-10));
var solver = new MlkBiCgStab();
var resultx = matrixA.SolveIterative(vectorb, solver, monitor);
Assert.AreEqual(matrixA.ColumnCount, resultx.Count);
var matrixBReconstruct = matrixA*resultx;
// Check the reconstruction.
for (var i = 0; i < order; i++)
{
Assert.AreEqual(vectorb[i], matrixBReconstruct[i], 1e-7);
}
}
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:22,代码来源:MlkBiCgStabTest.cs
示例9: SolvePoissonMatrixAndBackMultiply
public void SolvePoissonMatrixAndBackMultiply()
{
// Create the matrix
var matrix = Matrix<double>.Build.Sparse(100, 100);
// Assemble the matrix. We assume we're solving the Poisson equation
// on a rectangular 10 x 10 grid
const int GridSize = 10;
// The pattern is:
// 0 .... 0 -1 0 0 0 0 0 0 0 0 -1 4 -1 0 0 0 0 0 0 0 0 -1 0 0 ... 0
for (var i = 0; i < matrix.RowCount; i++)
{
// Insert the first set of -1's
if (i > (GridSize - 1))
{
matrix[i, i - GridSize] = -1;
}
// Insert the second set of -1's
if (i > 0)
{
matrix[i, i - 1] = -1;
}
// Insert the centerline values
matrix[i, i] = 4;
// Insert the first trailing set of -1's
if (i < matrix.RowCount - 1)
{
matrix[i, i + 1] = -1;
}
// Insert the second trailing set of -1's
if (i < matrix.RowCount - GridSize)
{
matrix[i, i + GridSize] = -1;
}
}
// Create the y vector
var y = Vector<double>.Build.Dense(matrix.RowCount, 1);
// Create an iteration monitor which will keep track of iterative convergence
var monitor = new Iterator<double>(
new IterationCountStopCriterion<double>(MaximumIterations),
new ResidualStopCriterion<double>(ConvergenceBoundary),
new DivergenceStopCriterion<double>(),
new FailureStopCriterion<double>());
var solver = new MlkBiCgStab();
// Solve equation Ax = y
var x = matrix.SolveIterative(y, solver, monitor);
// Now compare the results
Assert.IsNotNull(x, "#02");
Assert.AreEqual(y.Count, x.Count, "#03");
// Back multiply the vector
var z = matrix.Multiply(x);
// Check that the solution converged
Assert.IsTrue(monitor.Status == IterationStatus.Converged, "#04");
// Now compare the vectors
for (var i = 0; i < y.Count; i++)
{
Assert.GreaterOrEqual(ConvergenceBoundary, Math.Abs(y[i] - z[i]), "#05-" + i);
}
}
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:72,代码来源:MlkBiCgStabTest.cs
示例10: SolveUnitMatrixAndBackMultiply
public void SolveUnitMatrixAndBackMultiply()
{
// Create the identity matrix
var matrix = SparseMatrix.Identity(100);
// Create the y vector
var y = DenseVector.Create(matrix.RowCount, i => 1);
// Create an iteration monitor which will keep track of iterative convergence
var monitor = new Iterator<double>(new IIterationStopCriterium<double>[]
{
new IterationCountStopCriterium<double>(MaximumIterations),
new ResidualStopCriterium(ConvergenceBoundary),
new DivergenceStopCriterium(),
new FailureStopCriterium()
});
var solver = new TFQMR(monitor);
// Solve equation Ax = y
var x = solver.Solve(matrix, y);
// Now compare the results
Assert.IsNotNull(x, "#02");
Assert.AreEqual(y.Count, x.Count, "#03");
// Back multiply the vector
var z = matrix.Multiply(x);
// Check that the solution converged
Assert.IsTrue(monitor.HasConverged, "#04");
// Now compare the vectors
for (var i = 0; i < y.Count; i++)
{
Assert.IsTrue((y[i] - z[i]).IsSmaller(ConvergenceBoundary, 1), "#05-" + i);
}
}
开发者ID:primebing,项目名称:mathnet-numerics,代码行数:38,代码来源:TFQMRTest.cs
示例11: CanSolveForRandomVector
public void CanSolveForRandomVector(int order)
{
var matrixA = MatrixLoader.GenerateRandomDenseMatrix(order, order);
var vectorb = MatrixLoader.GenerateRandomDenseVector(order);
var monitor = new Iterator<double>(new IIterationStopCriterium<double>[]
{
new IterationCountStopCriterium<double>(1000),
new ResidualStopCriterium(1e-10),
});
var solver = new TFQMR(monitor);
var resultx = solver.Solve(matrixA, vectorb);
Assert.AreEqual(matrixA.ColumnCount, resultx.Count);
var matrixBReconstruct = matrixA*resultx;
// Check the reconstruction.
for (var i = 0; i < order; i++)
{
Assert.AreEqual(vectorb[i], matrixBReconstruct[i], 1e-7);
}
}
开发者ID:primebing,项目名称:mathnet-numerics,代码行数:23,代码来源:TFQMRTest.cs
示例12: SolvePoissonMatrixAndBackMultiply
public void SolvePoissonMatrixAndBackMultiply()
{
// Create the matrix
var matrix = new SparseMatrix(100);
// Assemble the matrix. We assume we're solving the Poisson equation
// on a rectangular 10 x 10 grid
const int GridSize = 10;
// The pattern is:
// 0 .... 0 -1 0 0 0 0 0 0 0 0 -1 4 -1 0 0 0 0 0 0 0 0 -1 0 0 ... 0
for (var i = 0; i < matrix.RowCount; i++)
{
// Insert the first set of -1's
if (i > (GridSize - 1))
{
matrix[i, i - GridSize] = -1;
}
// Insert the second set of -1's
if (i > 0)
{
matrix[i, i - 1] = -1;
}
// Insert the centerline values
matrix[i, i] = 4;
// Insert the first trailing set of -1's
if (i < matrix.RowCount - 1)
{
matrix[i, i + 1] = -1;
}
// Insert the second trailing set of -1's
if (i < matrix.RowCount - GridSize)
{
matrix[i, i + GridSize] = -1;
}
}
// Create the y vector
var y = DenseVector.Create(matrix.RowCount, i => 1);
// Create an iteration monitor which will keep track of iterative convergence
var monitor = new Iterator<double>(new IIterationStopCriterium<double>[]
{
new IterationCountStopCriterium<double>(MaximumIterations),
new ResidualStopCriterium(ConvergenceBoundary),
new DivergenceStopCriterium(),
new FailureStopCriterium()
});
var solver = new MlkBiCgStab(monitor);
// Solve equation Ax = y
var x = solver.Solve(matrix, y);
// Now compare the results
Assert.IsNotNull(x, "#02");
Assert.AreEqual(y.Count, x.Count, "#03");
// Back multiply the vector
var z = matrix.Multiply(x);
// Check that the solution converged
Assert.IsTrue(monitor.HasConverged, "#04");
// Now compare the vectors
for (var i = 0; i < y.Count; i++)
{
#if !PORTABLE
Assert.IsTrue(Math.Abs(y[i] - z[i]).IsSmaller(ConvergenceBoundary, 1), "#05-" + i);
#else
Assert.IsTrue(Math.Abs(y[i] - z[i]).IsSmaller(ConvergenceBoundary * 100.0, 1), "#05-" + i);
#endif
}
}
开发者ID:primebing,项目名称:mathnet-numerics,代码行数:77,代码来源:MlkBiCgStabTest.cs
示例13: SolveScaledUnitMatrixAndBackMultiply
public void SolveScaledUnitMatrixAndBackMultiply()
{
// Create the identity matrix
var matrix = Matrix<double>.Build.SparseIdentity(100);
// Scale it with a funny number
matrix.Multiply(Math.PI, matrix);
// Create the y vector
var y = Vector<double>.Build.Dense(matrix.RowCount, 1);
// Create an iteration monitor which will keep track of iterative convergence
var monitor = new Iterator<double>(
new IterationCountStopCriterion<double>(MaximumIterations),
new ResidualStopCriterion<double>(ConvergenceBoundary),
new DivergenceStopCriterion<double>(),
new FailureStopCriterion<double>());
var solver = new TFQMR();
// Solve equation Ax = y
var x = matrix.SolveIterative(y, solver, monitor);
// Now compare the results
Assert.IsNotNull(x, "#02");
Assert.AreEqual(y.Count, x.Count, "#03");
// Back multiply the vector
var z = matrix.Multiply(x);
// Check that the solution converged
Assert.IsTrue(monitor.Status == IterationStatus.Converged, "#04");
// Now compare the vectors
Assert.LessOrEqual(Distance.Chebyshev(y, z), 2*ConvergenceBoundary);
}
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:36,代码来源:TFQMRTest.cs
示例14: DetermineStatusWithNegativeIterationNumberThrowsArgumentOutOfRangeException
public void DetermineStatusWithNegativeIterationNumberThrowsArgumentOutOfRangeException()
{
var criteria = new List<IIterationStopCriterium<double>>
{
new FailureStopCriterium(),
new DivergenceStopCriterium(),
new IterationCountStopCriterium<double>(),
new ResidualStopCriterium()
};
var iterator = new Iterator<double>(criteria);
Assert.Throws<ArgumentOutOfRangeException>(() => iterator.DetermineStatus(
-1,
DenseVector.Create(3, i => 4),
DenseVector.Create(3, i => 5),
DenseVector.Create(3, i => 6)));
}
开发者ID:TransientResponse,项目名称:mathnet-numerics,代码行数:17,代码来源:IteratorTest.cs
示例15: InitializeSolver
private void InitializeSolver()
{
result = Vector<double>.Build.Dense(n * m);
Control.LinearAlgebraProvider = new OpenBlasLinearAlgebraProvider();
//Control.UseNativeMKL();
//Control.LinearAlgebraProvider = new MklLinearAlgebraProvider();
//Control.UseManaged();
var iterationCountStopCriterion = new IterationCountStopCriterion<double>(1000);
var residualStopCriterion = new ResidualStopCriterion<double>(1e-7);
monitor = new Iterator<double>(iterationCountStopCriterion, residualStopCriterion);
solver = new BiCgStab();
preconditioner = new MILU0Preconditioner();
}
开发者ID:vlad294,项目名称:PICSolver,代码行数:13,代码来源:Poisson2dFdmSolver.cs
示例16: Run
/// <summary>
/// Run example
/// </summary>
public void Run()
{
// Format matrix output to console
var formatProvider = (CultureInfo)CultureInfo.InvariantCulture.Clone();
formatProvider.TextInfo.ListSeparator = " ";
// Solve next system of linear equations (Ax=b):
// 5*x + 2*y - 4*z = -7
// 3*x - 7*y + 6*z = 38
// 4*x + 1*y + 5*z = 43
// Create matrix "A" with coefficients
var matrixA = DenseMatrix.OfArray(new[,] { { 5.00, 2.00, -4.00 }, { 3.00, -7.00, 6.00 }, { 4.00, 1.00, 5.00 } });
Console.WriteLine(@"Matrix 'A' with coefficients");
Console.WriteLine(matrixA.ToString("#0.00\t", formatProvider));
Console.WriteLine();
// Create vector "b" with the constant terms.
var vectorB = new DenseVector(new[] { -7.0, 38.0, 43.0 });
Console.WriteLine(@"Vector 'b' with the constant terms");
Console.WriteLine(vectorB.ToString("#0.00\t", formatProvider));
Console.WriteLine();
// Create stop criteriums to monitor an iterative calculation. There are next available stop criteriums:
// - DivergenceStopCriterium: monitors an iterative calculation for signs of divergence;
// - FailureStopCriterium: monitors residuals for NaN's;
// - IterationCountStopCriterium: monitors the numbers of iteration steps;
// - ResidualStopCriterium: monitors residuals if calculation is considered converged;
// Stop calculation if 1000 iterations reached during calculation
var iterationCountStopCriterium = new IterationCountStopCriterium<double>(1000);
// Stop calculation if residuals are below 1E-10 --> the calculation is considered converged
var residualStopCriterium = new ResidualStopCriterium(1e-10);
// Create monitor with defined stop criteriums
var monitor = new Iterator<double>(new IIterationStopCriterium<double>[] { iterationCountStopCriterium, residualStopCriterium });
// Create Transpose Free Quasi-Minimal Residual solver
var solver = new TFQMR(monitor);
// 1. Solve the matrix equation
var resultX = solver.Solve(matrixA, vectorB);
Console.WriteLine(@"1. Solve the matrix equation");
Console.WriteLine();
// 2. Check solver status of the iterations.
// Solver has property IterationResult which contains the status of the iteration once the calculation is finished.
// Possible values are:
// - CalculationCancelled: calculation was cancelled by the user;
// - CalculationConverged: calculation has converged to the desired convergence levels;
// - CalculationDiverged: calculation diverged;
// - CalculationFailure: calculation has failed for some reason;
// - CalculationIndetermined: calculation is indetermined, not started or stopped;
// - CalculationRunning: calculation is running and no results are yet known;
// - CalculationStoppedWithoutConvergence: calculation has been stopped due to reaching the stopping limits, but that convergence was not achieved;
Console.WriteLine(@"2. Solver status of the iterations");
Console.WriteLine(solver.IterationResult);
Console.WriteLine();
// 3. Solution result vector of the matrix equation
Console.WriteLine(@"3. Solution result vector of the matrix equation");
Console.WriteLine(resultX.ToString("#0.00\t", formatProvider));
Console.WriteLine();
// 4. Verify result. Multiply coefficient matrix "A" by result vector "x"
var reconstructVecorB = matrixA * resultX;
Console.WriteLine(@"4. Multiply coefficient matrix 'A' by result vector 'x'");
Console.WriteLine(reconstructVecorB.ToString("#0.00\t", formatProvider));
Console.WriteLine();
}
开发者ID:primebing,项目名称:mathnet-numerics,代码行数:74,代码来源:TFQMRSolver.cs
示例17: Run
/// <summary>
/// Run example
/// </summary>
public void Run()
{
// Format matrix output to console
var formatProvider = (CultureInfo)CultureInfo.InvariantCulture.Clone();
formatProvider.TextInfo.ListSeparator = " ";
// Solve next system of linear equations (Ax=b):
// 5*x + 2*y - 4*z = -7
// 3*x - 7*y + 6*z = 38
// 4*x + 1*y + 5*z = 43
// Create matrix "A" with coefficients
var matrixA = new DenseMatrix(new[,] { { 5.00, 2.00, -4.00 }, { 3.00, -7.00, 6.00 }, { 4.00, 1.00, 5.00 } });
Console.WriteLine(@"Matrix 'A' with coefficients");
Console.WriteLine(matrixA.ToString("#0.00\t", formatProvider));
Console.WriteLine();
// Create vector "b" with the constant terms.
var vectorB = new DenseVector(new[] { -7.0, 38.0, 43.0 });
Console.WriteLine(@"Vector 'b' with the constant terms");
Console.WriteLine(vectorB.ToString("#0.00\t", formatProvider));
Console.WriteLine();
// Create stop criteriums to monitor an iterative calculation. There are next available stop criteriums:
// - DivergenceStopCriterium: monitors an iterative calculation for signs of divergence;
// - FailureStopCriterium: monitors residuals for NaN's;
// - IterationCountStopCriterium: monitors the numbers of iteration steps;
// - ResidualStopCriterium: monitors residuals if calculation is considered converged;
// Stop calculation if 1000 iterations reached during calculation
var iterationCountStopCriterium = new IterationCountStopCriterium(1000);
// Stop calculation if residuals are below 1E-10 --> the calculation is considered converged
var residualStopCriterium = new ResidualStopCriterium(1e-10);
// Create monitor with defined stop criteriums
var monitor = new Iterator(new IIterationStopCriterium[] { iterationCountStopCriterium, residualStopCriterium });
// Load all suitable solvers from current assembly. Below in this example, there is user-defined solver
// "class UserBiCgStab : IIterativeSolverSetup<double>" which uses regular BiCgStab solver. But user may create any other solver
// and solver setup classes which implement IIterativeSolverSetup<T> and pass assembly to next function:
CompositeSolver.LoadSolverInformationFromAssembly(Assembly.GetExecutingAssembly());
// Create composite solver
var solver = new CompositeSolver(monitor);
// 1. Solve the matrix equation
var resultX = solver.Solve(matrixA, vectorB);
Console.WriteLine(@"1. Solve the matrix equation");
Console.WriteLine();
// 2. Check solver status of the iterations.
// Solver has property IterationResult which contains the status of the iteration once the calculation is finished.
// Possible values are:
// - CalculationCancelled: calculation was cancelled by the user;
// - CalculationConverged: calculation has converged to the desired convergence levels;
// - CalculationDiverged: calculation diverged;
// - CalculationFailure: calculation has failed for some reason;
// - CalculationIndetermined: calculation is indetermined, not started or stopped;
// - CalculationRunning: calculation is running and no results are yet known;
// - CalculationStoppedWithoutConvergence: calculation has been stopped due to reaching the stopping limits, but that convergence was not achieved;
Console.WriteLine(@"2. Solver status of the iterations");
Console.WriteLine(solver.IterationResult);
Console.WriteLine();
// 3. Solution result vector of the matrix equation
Console.WriteLine(@"3. Solution result vector of the matrix equation");
Console.WriteLine(resultX.ToString("#0.00\t", formatProvider));
Console.WriteLine();
// 4. Verify result. Multiply coefficient matrix "A" by result vector "x"
var reconstructVecorB = matrixA * resultX;
Console.WriteLine(@"4. Multiply coefficient matrix 'A' by result vector 'x'");
Console.WriteLine(reconstructVecorB.ToString("#0.00\t", formatProvider));
Console.WriteLine();
}
开发者ID:KeithVanderzanden,项目名称:mmbot,代码行数:79,代码来源:CompositeSolverExample.cs
注:本文中的MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterator类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论