diff --git a/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs b/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs index 8fad515d..46c32cfd 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs @@ -331,6 +331,34 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra /// This is similar to the GEQRF and ORGQR LAPACK routines. void QRFactor(double[] r, double[] q, double[] work); + /// + /// Solves A*X=B for X using QR factorization of A. + /// + /// The number of columns of B. + /// On entry, it is the M by N A matrix to factor. On exit, + /// it is overwritten with the R matrix of the QR factorization. + /// On exit, A M by M matrix that holds the Q matrix of the + /// QR factorization. + /// The B matrix. + /// On exit, the solution matrix. + void QRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x); + + /// + /// Solves A*X=B for X using QR factorization of A. + /// + /// The number of columns of B. + /// On entry, it is the M by N A matrix to factor. On exit, + /// it is overwritten with the R matrix of the QR factorization. + /// On exit, A M by M matrix that holds the Q matrix of the + /// QR factorization. + /// The B matrix. + /// On exit, the solution matrix. + /// The work array. The array must have a length of at least N, + /// but should be N*blocksize. The blocksize is machine dependent. Use + /// to determine the optimal size of the work array. On exit, work[0] contains the optimal + /// work size value. + void QRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x, double[] work); + /// /// Solves A*X=B for X using a previously QR factored matrix. /// @@ -339,7 +367,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra /// The R matrix obtained by calling . /// The B matrix. /// On exit, the solution matrix. - void QRSolve(int columnsOfB, double[] q, double[] r, double[] b, double[] x); + void QRSolveFactored(int columnsOfB, double[] q, double[] r, double[] b, double[] x); /// /// Computes the singular value decomposition of A. @@ -371,14 +399,41 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra /// This is equivalent to the GESVD LAPACK routine. void SingularValueDecomposition(bool computeVectors, double[] a, double[] s, double[] u, double[] vt, double[] work); + /// + /// Solves A*X=B for X using the singular value decomposition of A. + /// + /// On entry, the M by N matrix to decompose. On exit, A may be overwritten. + /// The singular values of A in ascending value. + /// On exit U contains the left singular vectors. + /// On exit VT contains the transposed right singular vectors. + /// The B matrix. + /// On exit, the solution matrix. + void SvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x); + + /// + /// Solves A*X=B for X using the singular value decomposition of A. + /// + /// On entry, the M by N matrix to decompose. On exit, A may be overwritten. + /// The singular values of A in ascending value. + /// On exit U contains the left singular vectors. + /// On exit VT contains the transposed right singular vectors. + /// The B matrix. + /// On exit, the solution matrix. + /// The work array. The array must have a length of at least N, + /// but should be N*blocksize. The blocksize is machine dependent. Use + /// to determine the optimal size of the work array. On exit, work[0] contains the optimal + /// work size value. + void SvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x, double[] work); + /// /// Solves A*X=B for X using a previously SVD decomposed matrix. /// + /// The number of columns of B. /// The s values returned by . /// The left singular vectors returned by . /// The right singular vectors returned by . /// The B matrix. /// On exit, the solution matrix. - void SvdSolve(double[] s, double[] u, double[] vt, double[] b, double[] x); + void SvdSolveFactored(int columnsOfB, double[] s, double[] u, double[] vt, double[] b, double[] x); } } diff --git a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs index 8fbaad63..6d382f90 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs @@ -204,7 +204,17 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra throw new NotImplementedException(); } - public void QRSolve(int columnsOfB, double[] q, double[] r, double[] b, double[] x) + public void QRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x) + { + throw new NotImplementedException(); + } + + public void QRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x, double[] work) + { + throw new NotImplementedException(); + } + + public void QRSolveFactored(int columnsOfB, double[] q, double[] r, double[] b, double[] x) { throw new NotImplementedException(); } @@ -214,13 +224,22 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra throw new NotImplementedException(); } - public void SingularValueDecomposition( - bool computeVectors, double[] a, double[] s, double[] u, double[] vt, double[] work) + public void SingularValueDecomposition(bool computeVectors, double[] a, double[] s, double[] u, double[] vt, double[] work) + { + throw new NotImplementedException(); + } + + public void SvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x) + { + throw new NotImplementedException(); + } + + public void SvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x, double[] work) { throw new NotImplementedException(); } - public void SvdSolve(double[] s, double[] u, double[] vt, double[] b, double[] x) + public void SvdSolveFactored(int columnsOfB, double[] s, double[] u, double[] vt, double[] b, double[] x) { throw new NotImplementedException(); }