public static MatrixStorage <T> MatrixStorage <T>(TestMatrixStorage type, T[,] data) where T : struct, IEquatable <T>, IFormattable { switch (type) { case TestMatrixStorage.DenseMatrix: return(DenseColumnMajorMatrixStorage <T> .OfArray(data)); case TestMatrixStorage.SparseMatrix: return(SparseCompressedRowMatrixStorage <T> .OfArray(data)); case TestMatrixStorage.DiagonalMatrix: return(DiagonalMatrixStorage <T> .OfArray(data)); default: throw new NotSupportedException(); } }
/// <summary> /// Create a new diagonal matrix as a copy of the given two-dimensional array. /// This new matrix will be independent from the provided array. /// The array to copy from must be diagonal as well. /// A new memory block will be allocated for storing the matrix. /// </summary> public static DiagonalMatrix OfArray(Complex[,] array) { return(new DiagonalMatrix(DiagonalMatrixStorage <Complex> .OfArray(array))); }
/// <summary> /// Create a new diagonal matrix as a copy of the given two-dimensional array. /// This new matrix will be independent from the provided array. /// The array to copy from must be diagonal as well. /// A new memory block will be allocated for storing the matrix. /// </summary> public static DiagonalMatrix OfArray(double[,] array) { return(new DiagonalMatrix(DiagonalMatrixStorage <double> .OfArray(array))); }
/// <summary> /// Create a new diagonal matrix as a copy of the given two-dimensional array. /// This new matrix will be independent from the provided array. /// The array to copy from must be diagonal as well. /// A new memory block will be allocated for storing the matrix. /// </summary> public static DiagonalMatrix OfArray(float[,] array) { return(new DiagonalMatrix(DiagonalMatrixStorage <float> .OfArray(array))); }
public DiagonalMatrix(Complex[,] array) : this(DiagonalMatrixStorage <Complex> .OfArray(array)) { }
public DiagonalMatrix(float[,] array) : this(DiagonalMatrixStorage <float> .OfArray(array)) { }
public DiagonalMatrix(double[,] array) : this(DiagonalMatrixStorage <double> .OfArray(array)) { }