本文整理汇总了C#中MathNet.Numerics.LinearAlgebra.Double.SparseMatrix.SetDiagonal方法的典型用法代码示例。如果您正苦于以下问题:C# SparseMatrix.SetDiagonal方法的具体用法?C# SparseMatrix.SetDiagonal怎么用?C# SparseMatrix.SetDiagonal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MathNet.Numerics.LinearAlgebra.Double.SparseMatrix
的用法示例。
在下文中一共展示了SparseMatrix.SetDiagonal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OfDiagonalVector
/// <summary>
/// Create a new sparse matrix with the diagonal as a copy of the given vector.
/// This new matrix will be independent from the vector.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfDiagonalVector(int rows, int columns, Vector<double> diagonal)
{
var m = new SparseMatrix(rows, columns);
m.SetDiagonal(diagonal);
return m;
}
示例2: OfDiagonalArray
/// <summary>
/// Create a new sparse matrix with the diagonal as a copy of the given array.
/// This new matrix will be independent from the array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfDiagonalArray(int rows, int columns, double[] diagonal)
{
var m = new SparseMatrix(rows, columns);
m.SetDiagonal(diagonal);
return m;
}