当前位置: 首页>>代码示例>>C#>>正文


C# SparseVector.ApproximatelyEqual方法代码示例

本文整理汇总了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)));
        }
开发者ID:feupeu,项目名称:NyhedsfilterP2,代码行数:12,代码来源:SparseMatrixTest.cs

示例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));
        }
开发者ID:feupeu,项目名称:NyhedsfilterP2,代码行数:17,代码来源:SparseMatrixTest.cs

示例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));
        }
开发者ID:feupeu,项目名称:NyhedsfilterP2,代码行数:17,代码来源:SparseMatrixTest.cs

示例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));
        }
开发者ID:feupeu,项目名称:NyhedsfilterP2,代码行数:17,代码来源:SparseMatrixTest.cs

示例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));
        }
开发者ID:feupeu,项目名称:NyhedsfilterP2,代码行数:11,代码来源:SparseMatrixTest.cs

示例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));
        }
开发者ID:feupeu,项目名称:NyhedsfilterP2,代码行数:13,代码来源:SparseVectorTest.cs


注:本文中的SparseVector.ApproximatelyEqual方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。