Esempio n. 1
0
        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)));
 }
Esempio n. 4
0
 /// <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)));
 }
Esempio n. 5
0
 public DiagonalMatrix(Complex[,] array)
     : this(DiagonalMatrixStorage <Complex> .OfArray(array))
 {
 }
Esempio n. 6
0
 public DiagonalMatrix(float[,] array)
     : this(DiagonalMatrixStorage <float> .OfArray(array))
 {
 }
Esempio n. 7
0
 public DiagonalMatrix(double[,] array)
     : this(DiagonalMatrixStorage <double> .OfArray(array))
 {
 }