本文整理汇总了C#中SparseVector.ApproximatelyEqual方法的典型用法代码示例。如果您正苦于以下问题:C# SparseVector.ApproximatelyEqual方法的具体用法?C# SparseVector.ApproximatelyEqual怎么用?C# SparseVector.ApproximatelyEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SparseVector
的用法示例。
在下文中一共展示了SparseVector.ApproximatelyEqual方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddColumnTestAddsColumnWithGivenValue
public void AddColumnTestAddsColumnWithGivenValue()
{
SparseVector expected = new SparseVector(TestMatrix.Rows);
expected[0] = 5.0f;
expected[1] = 5.0f;
expected[2] = 5.0f;
TestMatrix.AddColumn(5.0f);
Assert.IsTrue(expected.ApproximatelyEqual(
TestMatrix.ColumnVector(TestMatrix.Columns - 1)));
}
示例2: VectorProductTestVectorGreaterThanZero
public void VectorProductTestVectorGreaterThanZero()
{
SparseVector expected = new SparseVector(3);
expected[0] = 16.2f;
expected[1] = 13.9f;
expected[2] = 11.0f;
SparseVector v = new SparseVector(5);
v[0] = 1f;
v[1] = 2f;
v[2] = 3f;
v[3] = 4f;
v[4] = 5f;
v = TestMatrix.VectorProduct(v);
Assert.IsTrue(expected.ApproximatelyEqual(v));
}
示例3: VectorProductTestValuesLessThanZero
public void VectorProductTestValuesLessThanZero()
{
SparseVector expected = new SparseVector(3);
expected[0] = -16.2f;
expected[1] = -13.9f;
expected[2] = -11.0f;
SparseVector v = new SparseVector(5);
v[0] = -1f;
v[1] = -2f;
v[2] = -3f;
v[3] = -4f;
v[4] = -5f;
v = TestMatrix.VectorProduct(v);
Assert.IsTrue(expected.ApproximatelyEqual(v));
}
示例4: VectorProductTestNullVector
public void VectorProductTestNullVector()
{
SparseVector expected = new SparseVector(3);
expected[0] = 0f;
expected[1] = 0f;
expected[2] = 0f;
SparseVector v = new SparseVector(5);
v[0] = 0f;
v[0] = 0f;
v[0] = 0f;
v[0] = 0f;
v[0] = 0f;
v = TestMatrix.VectorProduct(v);
Assert.IsTrue(expected.ApproximatelyEqual(v));
}
示例5: ColumnVectorTestCorrect
public void ColumnVectorTestCorrect()
{
SparseVector expected = new SparseVector(3);
expected[0] = 3.0f;
expected[2] = 0.5f;
SparseVector result = TestMatrix.ColumnVector(0);
Assert.IsTrue(expected.ApproximatelyEqual(result));
}
示例6: NormalizeTestWhenLessThanZero
public void NormalizeTestWhenLessThanZero()
{
TestVector[4] = -TestVector[4];
SparseVector expected = new SparseVector(5);
expected[1] = 0.2182179f;
expected[2] = 0.4364358f;
expected[4] = -0.8728715f;
SparseVector result = TestVector.Normalize();
Assert.IsTrue(expected.ApproximatelyEqual(result));
}