diff --git a/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs b/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs index a7dbb5b2..27253391 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs @@ -39,106 +39,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra /// /// Interface to linear algebra algorithms that work off 1-D arrays. /// - public interface ILinearAlgebraProvider : ILinearAlgebraProvider, ILinearAlgebraProvider, ILinearAlgebraProvider, ILinearAlgebraProvider + public interface ILinearAlgebraProvider : ILinearAlgebraProvider, ILinearAlgebraProvider, ILinearAlgebraProvider, ILinearAlgebraProvider { - /// - /// Computes the requested of the matrix. - /// - /// The type of norm to compute. - /// The number of rows. - /// The number of columns. - /// The matrix to compute the norm from. - /// The work array. Only used when - /// and needs to be have a length of at least M (number of rows of . - /// - /// The requested of the matrix. - /// - float MatrixNorm(Norm norm, int rows, int columns, float[] matrix, float[] work); - - /// - /// Computes the requested of the matrix. - /// - /// The type of norm to compute. - /// The number of rows. - /// The number of columns. - /// The matrix to compute the norm from. - /// The work array. Only used when - /// and needs to be have a length of at least M (number of rows of . - /// - /// The requested of the matrix. - /// - double MatrixNorm(Norm norm, int rows, int columns, double[] matrix, double[] work); - - /// - /// Computes the requested of the matrix. - /// - /// The type of norm to compute. - /// The number of rows. - /// The number of columns. - /// The matrix to compute the norm from. - /// The work array. Only used when - /// and needs to be have a length of at least M (number of rows of . - /// - /// The requested of the matrix. - /// - Complex32 MatrixNorm(Norm norm, int rows, int columns, Complex32[] matrix, float[] work); - - /// - /// Computes the requested of the matrix. - /// - /// The type of norm to compute. - /// The number of rows. - /// The number of columns. - /// The matrix to compute the norm from. - /// The work array. Only used when - /// and needs to be have a length of at least M (number of rows of . - /// - /// The requested of the matrix. - /// - Complex MatrixNorm(Norm norm, int rows, int columns, Complex[] matrix, double[] work); - - /// - /// Computes the eigenvalues and eigenvectors of a matrix. - /// - /// Wether the matrix is symmetric or not. - /// The order of the matrix. - /// The matrix to decompose. The lenth of the array must be order * order. - /// On output, the matrix contains the eigen vectors. The lenth of the array must be order * order. - /// On output, the eigen values (λ) of matrix in ascending value. The length of the arry must . - /// On output, the block diagonal eigenvalue matrix. The lenth of the array must be order * order. - void EigenDecomp(bool isSymmetric, int order, float[] matrix, float[] matrixEv, Complex[] vectorEv, float[] matrixD); - - /// - /// Computes the eigenvalues and eigenvectors of a matrix. - /// - /// Wether the matrix is symmetric or not. - /// The order of the matrix. - /// The matrix to decompose. The lenth of the array must be order * order. - /// On output, the matrix contains the eigen vectors. The lenth of the array must be order * order. - /// On output, the eigen values (λ) of matrix in ascending value. The length of the arry must . - /// On output, the block diagonal eigenvalue matrix. The lenth of the array must be order * order. - void EigenDecomp(bool isSymmetric, int order, double[] matrix, double[] matrixEv, Complex[] vectorEv, double[] matrixD); - - /// - /// Computes the eigenvalues and eigenvectors of a matrix. - /// - /// Wether the matrix is symmetric or not. - /// The order of the matrix. - /// The matrix to decompose. The lenth of the array must be order * order. - /// On output, the matrix contains the eigen vectors. The lenth of the array must be order * order. - /// On output, the eigen values (λ) of matrix in ascending value. The length of the arry must . - /// On output, the block diagonal eigenvalue matrix. The lenth of the array must be order * order. - void EigenDecomp(bool isSymmetric, int order, Complex32[] matrix, Complex32[] matrixEv, Complex[] vectorEv, Complex32[] matrixD); - - /// - /// Computes the eigenvalues and eigenvectors of a matrix. - /// - /// Wether the matrix is symmetric or not. - /// The order of the matrix. - /// The matrix to decompose. The lenth of the array must be order * order. - /// On output, the matrix contains the eigen vectors. The lenth of the array must be order * order. - /// On output, the eigen values (λ) of matrix in ascending value. The length of the arry must . - /// On output, the block diagonal eigenvalue matrix. The lenth of the array must be order * order. - void EigenDecomp(bool isSymmetric, int order, Complex[] matrix, Complex[] matrixEv, Complex[] vectorEv, Complex[] matrixD); } } diff --git a/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProviderOfT.cs b/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProviderOfT.cs index 840eb35e..ca951440 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProviderOfT.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProviderOfT.cs @@ -30,6 +30,11 @@ using MathNet.Numerics.LinearAlgebra.Factorization; namespace MathNet.Numerics.Algorithms.LinearAlgebra { + +#if !NOSYSNUMERICS + using Complex = System.Numerics.Complex; +#endif + /// /// How to transpose a matrix. /// @@ -82,8 +87,9 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra /// Interface to linear algebra algorithms that work off 1-D arrays. /// /// Supported data types are double, single, Complex, and Complex32. - public interface ILinearAlgebraProvider + public interface ILinearAlgebraProvider where T : struct + where TNorm : struct { /*/// /// Queries the provider for the optimal, workspace block size @@ -182,6 +188,20 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra /// T MatrixNorm(Norm norm, int rows, int columns, T[] matrix); + /// + /// Computes the requested of the matrix. + /// + /// The type of norm to compute. + /// The number of rows. + /// The number of columns. + /// The matrix to compute the norm from. + /// The work array. Only used when + /// and needs to be have a length of at least M (number of rows of . + /// + /// The requested of the matrix. + /// + T MatrixNorm(Norm norm, int rows, int columns, T[] matrix, TNorm[] work); + /// /// Multiples two matrices. result = x * y /// @@ -496,5 +516,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra /// The number of columns of B. /// On exit, the solution matrix. void SvdSolveFactored(int rowsA, int columnsA, T[] s, T[] u, T[] vt, T[] b, int columnsB, T[] x); + + /// + /// Computes the eigenvalues and eigenvectors of a matrix. + /// + /// Wether the matrix is symmetric or not. + /// The order of the matrix. + /// The matrix to decompose. The lenth of the array must be order * order. + /// On output, the matrix contains the eigen vectors. The lenth of the array must be order * order. + /// On output, the eigen values (λ) of matrix in ascending value. The length of the arry must . + /// On output, the block diagonal eigenvalue matrix. The lenth of the array must be order * order. + void EigenDecomp(bool isSymmetric, int order, T[] matrix, T[] matrixEv, Complex[] vectorEv, T[] matrixD); } }