本文整理汇总了C#中ResidualStopCriterium类的典型用法代码示例。如果您正苦于以下问题:C# ResidualStopCriterium类的具体用法?C# ResidualStopCriterium怎么用?C# ResidualStopCriterium使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResidualStopCriterium类属于命名空间,在下文中一共展示了ResidualStopCriterium类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Create
public void Create()
{
var criterium = new ResidualStopCriterium<float>(1e-6f, 50);
Assert.AreEqual(1e-6f, criterium.Maximum, "Incorrect maximum");
Assert.AreEqual(50, criterium.MinimumIterationsBelowMaximum, "Incorrect iteration count");
}
开发者ID:rmundy,项目名称:mathnet-numerics,代码行数:7,代码来源:ResidualStopCriteriumTest.cs
示例2: ResetMaximum
public void ResetMaximum()
{
var criterium = new ResidualStopCriterium(1e-8, 50);
Assert.IsNotNull(criterium, "There should be a criterium");
criterium.ResetMaximumResidualToDefault();
Assert.AreEqual(ResidualStopCriterium.DefaultMaximumResidual, criterium.Maximum, "Incorrect maximum");
}
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:8,代码来源:ResidualStopCriteriumTest.cs
示例3: Create
public void Create()
{
var criterium = new ResidualStopCriterium(1e-8, 50);
Assert.IsNotNull(criterium, "There should be a criterium");
Assert.AreEqual(1e-8, criterium.Maximum, "Incorrect maximum");
Assert.AreEqual(50, criterium.MinimumIterationsBelowMaximum, "Incorrect iteration count");
}
开发者ID:KeithVanderzanden,项目名称:mmbot,代码行数:8,代码来源:ResidualStopCriteriumTest.cs
示例4: DetermineStatusWithIllegalIterationNumberThrowsArgumentOutOfRangeException
public void DetermineStatusWithIllegalIterationNumberThrowsArgumentOutOfRangeException()
{
var criterium = new ResidualStopCriterium<Complex32>(1e-6f, 50);
Assert.Throws<ArgumentOutOfRangeException>(() => criterium.DetermineStatus(
-1,
DenseVector.Create(3, i => 4),
DenseVector.Create(3, i => 5),
DenseVector.Create(3, i => 6)));
}
开发者ID:EricGT,项目名称:mathnet-numerics,代码行数:10,代码来源:ResidualStopCriteriumTest.cs
示例5: Clone
public void Clone()
{
var criterium = new ResidualStopCriterium<Complex32>(1e-3f, 10);
var clone = criterium.Clone();
Assert.IsInstanceOf(typeof(ResidualStopCriterium<Complex32>), clone, "Wrong criterium type");
var clonedCriterium = clone as ResidualStopCriterium<Complex32>;
Assert.IsNotNull(clonedCriterium);
Assert.AreEqual(criterium.Maximum, clonedCriterium.Maximum, "Clone failed");
Assert.AreEqual(criterium.MinimumIterationsBelowMaximum, clonedCriterium.MinimumIterationsBelowMaximum, "Clone failed");
}
开发者ID:kityandhero,项目名称:mathnet-numerics,代码行数:13,代码来源:ResidualStopCriteriumTest.cs
示例6: Clone
public void Clone()
{
var criterium = new ResidualStopCriterium(1e-3, 10);
Assert.IsNotNull(criterium, "There should be a criterium");
var clone = criterium.Clone();
Assert.IsInstanceOfType(typeof(ResidualStopCriterium), clone, "Wrong criterium type");
var clonedCriterium = clone as ResidualStopCriterium;
Assert.IsNotNull(clonedCriterium);
// ReSharper disable PossibleNullReferenceException
Assert.AreEqual(criterium.Maximum, clonedCriterium.Maximum, "Clone failed");
Assert.AreEqual(criterium.MinimumIterationsBelowMaximum, clonedCriterium.MinimumIterationsBelowMaximum, "Clone failed");
// ReSharper restore PossibleNullReferenceException
}
开发者ID:xmap2008,项目名称:mathnet-numerics,代码行数:15,代码来源:ResidualStopCriteriumTest.cs
示例7: DetermineStatus
public void DetermineStatus()
{
var criterium = new ResidualStopCriterium(1e-3, 10);
Assert.IsNotNull(criterium, "There should be a criterium");
// Note that the solution vector isn't actually being used so ...
var solution = new DenseVector(new[] { double.NaN, double.NaN, double.NaN });
// Set the source values
var source = new DenseVector(new[] { 1.000, 1.000, 2.001 });
// Set the residual values
var residual = new DenseVector(new[] { 0.001, 0.001, 0.002 });
criterium.DetermineStatus(5, solution, source, residual);
Assert.IsInstanceOfType(typeof(CalculationRunning), criterium.Status, "Should still be running");
criterium.DetermineStatus(16, solution, source, residual);
Assert.IsInstanceOfType(typeof(CalculationConverged), criterium.Status, "Should be done");
}
开发者ID:xmap2008,项目名称:mathnet-numerics,代码行数:20,代码来源:ResidualStopCriteriumTest.cs
示例8: DetermineStatusWithNonMatchingSourceVectorThrowsArgumentException
public void DetermineStatusWithNonMatchingSourceVectorThrowsArgumentException()
{
var criterium = new ResidualStopCriterium<float>(1e-6f, 50);
Assert.Throws<ArgumentException>(() => criterium.DetermineStatus(
1,
Vector<float>.Build.Dense(3, 4),
Vector<float>.Build.Dense(4, 4),
Vector<float>.Build.Dense(3, 4)));
}
开发者ID:rmundy,项目名称:mathnet-numerics,代码行数:10,代码来源:ResidualStopCriteriumTest.cs
示例9: DetermineStatusWithIllegalIterationNumberThrowsArgumentOutOfRangeException
public void DetermineStatusWithIllegalIterationNumberThrowsArgumentOutOfRangeException()
{
var criterium = new ResidualStopCriterium<float>(1e-6f, 50);
Assert.Throws<ArgumentOutOfRangeException>(() => criterium.DetermineStatus(
-1,
Vector<float>.Build.Dense(3, 4),
Vector<float>.Build.Dense(3, 5),
Vector<float>.Build.Dense(3, 6)));
}
开发者ID:rmundy,项目名称:mathnet-numerics,代码行数:10,代码来源:ResidualStopCriteriumTest.cs
示例10: DetermineStatusWithNonMatchingSolutionVector
public void DetermineStatusWithNonMatchingSolutionVector()
{
var criterium = new ResidualStopCriterium(1e-8, 50);
Assert.IsNotNull(criterium, "There should be a criterium");
criterium.DetermineStatus(1,
new DenseVector(4, 4),
new DenseVector(3, 4),
new DenseVector(3, 4));
}
开发者ID:xmap2008,项目名称:mathnet-numerics,代码行数:10,代码来源:ResidualStopCriteriumTest.cs
示例11: ResetMinimumIterationsBelowMaximum
public void ResetMinimumIterationsBelowMaximum()
{
var criterium = new ResidualStopCriterium(1e-8, 50);
Assert.IsNotNull(criterium, "There should be a criterium");
criterium.ResetMinimumIterationsBelowMaximumToDefault();
Assert.AreEqual(ResidualStopCriterium.DefaultMinimumIterationsBelowMaximum, criterium.MinimumIterationsBelowMaximum, "Incorrect iteration count");
}
开发者ID:KeithVanderzanden,项目名称:mmbot,代码行数:8,代码来源:ResidualStopCriteriumTest.cs
示例12: DetermineStatusWithSourceNaN
public void DetermineStatusWithSourceNaN()
{
var criterium = new ResidualStopCriterium(1e-3, 10);
Assert.IsNotNull(criterium, "There should be a criterium");
var solution = new DenseVector(new[] { 1.0, 1.0, 2.0 });
var source = new DenseVector(new[] { 1.0, 1.0, double.NaN });
var residual = new DenseVector(new[] { 1000.0, 1000.0, 2001.0 });
criterium.DetermineStatus(5, solution, source, residual);
Assert.IsInstanceOf(typeof(CalculationDiverged), criterium.Status, "Should be diverged");
}
开发者ID:KeithVanderzanden,项目名称:mmbot,代码行数:12,代码来源:ResidualStopCriteriumTest.cs
示例13: DetermineStatusWithIllegalIterationNumberThrowsArgumentOutOfRangeException
public void DetermineStatusWithIllegalIterationNumberThrowsArgumentOutOfRangeException()
{
var criterium = new ResidualStopCriterium(1e-8, 50);
Assert.IsNotNull(criterium, "There should be a criterium");
Assert.Throws<ArgumentOutOfRangeException>(() => criterium.DetermineStatus(
-1,
new DenseVector(3, 4),
new DenseVector(3, 5),
new DenseVector(3, 6)));
}
开发者ID:KeithVanderzanden,项目名称:mmbot,代码行数:11,代码来源:ResidualStopCriteriumTest.cs
示例14: ResetCalculationState
public void ResetCalculationState()
{
var criterium = new ResidualStopCriterium<Complex>(1e-3, 10);
var solution = new DenseVector(new[] {new Complex(0.001, 1), new Complex(0.001, 1), new Complex(0.002, 1)});
var source = new DenseVector(new[] {new Complex(0.001, 1), new Complex(0.001, 1), new Complex(0.002, 1)});
var residual = new DenseVector(new[] {new Complex(1.000, 0), new Complex(1.000, 0), new Complex(2.001, 0)});
var status = criterium.DetermineStatus(5, solution, source, residual);
Assert.AreEqual(IterationStatus.Continue, status, "Should be running");
criterium.Reset();
Assert.AreEqual(IterationStatus.Continue, criterium.Status, "Should not have started");
}
开发者ID:EricGT,项目名称:mathnet-numerics,代码行数:14,代码来源:ResidualStopCriteriumTest.cs
示例15: DetermineStatusWithSourceNaN
public void DetermineStatusWithSourceNaN()
{
var criterium = new ResidualStopCriterium(1e-3f, 10);
Assert.IsNotNull(criterium, "There should be a criterium");
var solution = new DenseVector(new[] { new Complex32(1.0f, 1), new Complex32(1.0f, 1), new Complex32(2.0f, 1) });
var source = new DenseVector(new[] { new Complex32(1.0f, 1), new Complex32(1.0f, 1), new Complex32(float.NaN, 1) });
var residual = new DenseVector(new[] { new Complex32(1000.0f, 1), new Complex32(1000.0f, 1), new Complex32(2001.0f, 1) });
criterium.DetermineStatus(5, solution, source, residual);
Assert.IsInstanceOf(typeof(CalculationDiverged), criterium.Status, "Should be diverged");
}
开发者ID:jvangael,项目名称:mathnet-numerics,代码行数:12,代码来源:ResidualStopCriteriumTest.cs
示例16: DetermineStatusWithNonMatchingSolutionVectorThrowsArgumentException
public void DetermineStatusWithNonMatchingSolutionVectorThrowsArgumentException()
{
var criterium = new ResidualStopCriterium(1e-6f, 50);
Assert.IsNotNull(criterium, "There should be a criterium");
Assert.Throws<ArgumentException>(() => criterium.DetermineStatus(
1,
new DenseVector(4, 4),
new DenseVector(3, 4),
new DenseVector(3, 4)));
}
开发者ID:jvangael,项目名称:mathnet-numerics,代码行数:11,代码来源:ResidualStopCriteriumTest.cs
示例17: DetermineStatus
public void DetermineStatus()
{
var criterium = new ResidualStopCriterium(1e-3f, 10);
Assert.IsNotNull(criterium, "There should be a criterium");
// the solution vector isn't actually being used so ...
var solution = new DenseVector(new[] { new Complex32(float.NaN, float.NaN), new Complex32(float.NaN, float.NaN), new Complex32(float.NaN, float.NaN) });
// Set the source values
var source = new DenseVector(new[] { new Complex32(1.000f, 1), new Complex32(1.000f, 1), new Complex32(2.001f, 1) });
// Set the residual values
var residual = new DenseVector(new[] { new Complex32(0.001f, 0), new Complex32(0.001f, 0), new Complex32(0.002f, 0) });
criterium.DetermineStatus(5, solution, source, residual);
Assert.IsInstanceOf(typeof(CalculationRunning), criterium.Status, "Should still be running");
criterium.DetermineStatus(16, solution, source, residual);
Assert.IsInstanceOf(typeof(CalculationConverged), criterium.Status, "Should be done");
}
开发者ID:jvangael,项目名称:mathnet-numerics,代码行数:20,代码来源:ResidualStopCriteriumTest.cs
示例18: DetermineStatusWithNullSourceVector
public void DetermineStatusWithNullSourceVector()
{
var criterium = new ResidualStopCriterium(1e-8, 50);
Assert.IsNotNull(criterium, "There should be a criterium");
criterium.DetermineStatus(1,
new DenseVector(3, 4),
null,
new DenseVector(3, 6));
Assert.Fail();
}
开发者ID:xmap2008,项目名称:mathnet-numerics,代码行数:11,代码来源:ResidualStopCriteriumTest.cs
示例19: DetermineStatusWithSourceNaN
public void DetermineStatusWithSourceNaN()
{
var criterium = new ResidualStopCriterium<float>(1e-3f, 10);
var solution = new DenseVector(new[] {1.0f, 1.0f, 2.0f});
var source = new DenseVector(new[] {1.0f, 1.0f, float.NaN});
var residual = new DenseVector(new[] {1000.0f, 1000.0f, 2001.0f});
var status = criterium.DetermineStatus(5, solution, source, residual);
Assert.AreEqual(IterationStatus.Diverged, status, "Should be diverged");
}
开发者ID:rmundy,项目名称:mathnet-numerics,代码行数:11,代码来源:ResidualStopCriteriumTest.cs
示例20: DetermineStatusWithNonMatchingResidualVectorThrowsArgumentException
public void DetermineStatusWithNonMatchingResidualVectorThrowsArgumentException()
{
var criterium = new ResidualStopCriterium(1e-8, 50);
Assert.IsNotNull(criterium, "There should be a criterium");
Assert.Throws<ArgumentException>(() => criterium.DetermineStatus(
1,
DenseVector.Create(3, i => 4),
DenseVector.Create(3, i => 4),
DenseVector.Create(4, i => 4)));
}
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:11,代码来源:ResidualStopCriteriumTest.cs
注:本文中的ResidualStopCriterium类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论