/// <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<float> diagonal)
 {
     var m = new SparseMatrix(rows, columns);
     m.SetDiagonal(diagonal);
     return m;
 }
 /// <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, float[] diagonal)
 {
     var m = new SparseMatrix(rows, columns);
     m.SetDiagonal(diagonal);
     return m;
 }
 /// <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(Vector<float> diagonal)
 {
     var m = new SparseMatrix(diagonal.Count, diagonal.Count);
     m.SetDiagonal(diagonal);
     return m;
 }
 /// <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(float[] diagonal)
 {
     var m = new SparseMatrix(diagonal.Length, diagonal.Length);
     m.SetDiagonal(diagonal);
     return m;
 }