本文整理汇总了C#中MathNet.Numerics.LinearAlgebra.Double.SparseMatrix.Normalize方法的典型用法代码示例。如果您正苦于以下问题:C# SparseMatrix.Normalize方法的具体用法?C# SparseMatrix.Normalize怎么用?C# SparseMatrix.Normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MathNet.Numerics.LinearAlgebra.Double.SparseMatrix
的用法示例。
在下文中一共展示了SparseMatrix.Normalize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SparseMatrixIndexedEnumeratorWorks
public void SparseMatrixIndexedEnumeratorWorks()
{
var cols = 7;
var rows = 7;
var matrix = new SparseMatrix(rows, cols, new double[] { 2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, /**/2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, 34.5104995998366, 3.30253638788279, 2.7461515689052E-06, 2.7461515689052E-06, /**/2.7461515689052E-06, 2.7461515689052E-06, 3.30253638788279, 255, 3.30253638788279, 2.7461515689052E-06, 2.37450036851675E-06, /**/2.7461515689052E-06, 2.7461515689052E-06, 24.4026090935093, 255, 24.4026090935093, 2.7461515689052E-06, 2.7461515689052E-06, /**/2.7461515689052E-06, 2.7461515689052E-06, 3.30253638788279, 34.5104995998366, 3.30253638788279, 2.7461515689052E-06, 2.37450036851675E-06, /**/2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, /**/2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06, 6.62979636198309E-06, 2.7461515689052E-06, 2.7461515689052E-06, 2.7461515689052E-06 });
var normalized = matrix.Normalize(1.0, 2.7461515689052E-06);
//
var count = 0;
foreach (var el in matrix.IndexedEnumerator())
{
count++;
}
var count2 = 0;
foreach (var el in normalized.IndexedEnumerator())
{
count2++;
}
//
Assert.AreEqual(cols * rows, count);
Assert.AreEqual(cols * rows, count2);
}