Browse Source

svd: merged Andriy's svd code and qr work array update

la-knuth
Marcus Cuda 16 years ago
parent
commit
b61a1a97b9
  1. 398
      src/Numerics/Algorithms/LinearAlgebra/Atlas/AtlasLinearAlgebraProvider.cs
  2. 72
      src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProviderOfT.cs
  3. 2626
      src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs
  4. 398
      src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs
  5. 396
      src/Numerics/Algorithms/LinearAlgebra/NativeAlgebraProvider.include
  6. 23
      src/Numerics/LinearAlgebra/Double/Factorization/DenseQR.cs
  7. 180
      src/Numerics/LinearAlgebra/Double/Factorization/DenseSvd.cs
  8. 11
      src/Numerics/LinearAlgebra/Double/Factorization/ExtensionMethods.cs
  9. 4
      src/Numerics/LinearAlgebra/Double/Factorization/QR.cs
  10. 283
      src/Numerics/LinearAlgebra/Double/Factorization/Svd.cs
  11. 2
      src/Numerics/Numerics.csproj
  12. 18
      src/Numerics/Properties/Resources.Designer.cs
  13. 6
      src/Numerics/Properties/Resources.resx
  14. 6
      src/Silverlight/Silverlight.csproj
  15. 370
      src/UnitTests/LinearAlgebraTests/Double/Factorization/SvdTests.cs
  16. 1
      src/UnitTests/UnitTests.csproj

398
src/Numerics/Algorithms/LinearAlgebra/Atlas/AtlasLinearAlgebraProvider.cs

@ -28,7 +28,7 @@
/* This file is automatically generated - do not modify it.
Change NativeLinearAlgebraProvider.include instead.
Last generated on UTC 2010-06-27 13:41:23Z
Last generated on UTC 2010-07-04 13:21:14Z
*/
namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
@ -235,6 +235,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
@ -248,6 +250,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/>
/// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param>
@ -452,24 +456,25 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.d_cholesky_factor(order, a);
SafeNativeMethods.d_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.
/// </remarks>
public void CholeskySolve(double[] a, int aOrder, double[] b, int bRows, int bColumns)
{
throw new NotImplementedException();
@ -481,8 +486,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(double[] a, int aOrder, double[] b, int bRows, int bColumns)
{
@ -493,11 +498,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(double[] r, double[] q)
public void QRFactor(double[] r, int rRows, int rColumns, double[] q)
{
throw new NotImplementedException();
}
@ -506,13 +513,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(double[] r, double[] q, double[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(double[] r, int rRows, int rColumns, double[] q, double[] work)
{
throw new NotImplementedException();
}
@ -520,14 +530,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x)
public void QRSolve(double[] r, int rRows, int rColumns, double[] q, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -535,17 +547,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x, double[] work)
public void QRSolve(double[] r, int rRows, int rColumns, double[] q, double[] b, int bColumns, double[] x, double[] work)
{
throw new NotImplementedException();
}
@ -553,12 +567,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(double[],double[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(double[],double[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(double[],int,int,double[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(double[],int,int,double[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, double[] q, double[] r, double[] b, double[] x)
public void QRSolveFactored(double[] q, double[] r, int rRows, int rColumns, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -568,13 +584,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, double[] a, double[] s, double[] u, double[] vt)
public void SingularValueDecomposition(bool computeVectors, double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt)
{
throw new NotImplementedException();
}
@ -584,6 +602,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -593,7 +613,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, double[] a, double[] s, double[] u, double[] vt, double[] work)
public void SingularValueDecomposition(bool computeVectors, double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] work)
{
throw new NotImplementedException();
}
@ -602,12 +622,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x)
public void SvdSolve(double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -616,15 +639,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x, double[] work)
public void SvdSolve(double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] b, int bColumns, double[] x, double[] work)
{
throw new NotImplementedException();
}
@ -632,13 +658,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,double[],double[],double[],double[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],double[],double[],double[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],double[],double[],double[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,double[],int,int,double[],double[],double[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],int,int,double[],double[],double[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],int,int,double[],double[],double[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, double[] s, double[] u, double[] vt, double[] b, double[] x)
public void SvdSolveFactored(int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -836,6 +864,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
@ -849,6 +879,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/>
/// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param>
@ -926,6 +958,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
SafeNativeMethods.s_matrix_multiply(transposeA, transposeB, m, n, k, alpha, a, b, beta, c);
}
/// <summary>
/// <summary>
/// Computes the LUP factorization of A. P*A = L*U.
/// </summary>
@ -1053,23 +1086,23 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.s_cholesky_factor(order, a);
SafeNativeMethods.s_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
public void CholeskySolve(float[] a, int aOrder, float[] b, int bRows, int bColumns)
{
@ -1082,8 +1115,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(float[] a, int aOrder, float[] b, int bRows, int bColumns)
{
@ -1094,11 +1127,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(float[] r, float[] q)
public void QRFactor(float[] r, int rRows, int rColumns, float[] q)
{
throw new NotImplementedException();
}
@ -1107,13 +1142,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(float[] r, float[] q, float[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(float[] r, int rRows, int rColumns, float[] q, float[] work)
{
throw new NotImplementedException();
}
@ -1121,14 +1159,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, float[] r, float[] q, float[] b, float[] x)
public void QRSolve(float[] r, int rRows, int rColumns, float[] q, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1136,17 +1176,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, float[] r, float[] q, float[] b, float[] x, float[] work)
public void QRSolve(float[] r, int rRows, int rColumns, float[] q, float[] b, int bColumns, float[] x, float[] work)
{
throw new NotImplementedException();
}
@ -1154,12 +1196,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(float[],float[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(float[],float[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(float[],int,int,float[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(float[],int,int,float[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, float[] q, float[] r, float[] b, float[] x)
public void QRSolveFactored(float[] q, float[] r, int rRows, int rColumns, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1169,13 +1213,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, float[] a, float[] s, float[] u, float[] vt)
public void SingularValueDecomposition(bool computeVectors, float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt)
{
throw new NotImplementedException();
}
@ -1185,6 +1231,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -1194,7 +1242,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, float[] a, float[] s, float[] u, float[] vt, float[] work)
public void SingularValueDecomposition(bool computeVectors, float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] work)
{
throw new NotImplementedException();
}
@ -1203,12 +1251,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(float[] a, float[] s, float[] u, float[] vt, float[] b, float[] x)
public void SvdSolve(float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1217,15 +1268,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(float[] a, float[] s, float[] u, float[] vt, float[] b, float[] x, float[] work)
public void SvdSolve(float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] b, int bColumns, float[] x, float[] work)
{
throw new NotImplementedException();
}
@ -1233,13 +1287,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,float[],float[],float[],float[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],float[],float[],float[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],float[],float[],float[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,float[],int,int,float[],float[],float[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],int,int,float[],float[],float[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],int,int,float[],float[],float[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, float[] s, float[] u, float[] vt, float[] b, float[] x)
public void SvdSolveFactored(int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1437,6 +1493,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
@ -1450,6 +1508,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/>
/// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param>
@ -1654,23 +1714,23 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.z_cholesky_factor(order, a);
SafeNativeMethods.z_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
public void CholeskySolve(Complex[] a, int aOrder, Complex[] b, int bRows, int bColumns)
{
@ -1683,8 +1743,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(Complex[] a, int aOrder, Complex[] b, int bRows, int bColumns)
{
@ -1695,11 +1755,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex[] r, Complex[] q)
public void QRFactor(Complex[] r, int rRows, int rColumns, Complex[] q)
{
throw new NotImplementedException();
}
@ -1708,13 +1770,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(Complex[] r, Complex[] q, Complex[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex[] r, int rRows, int rColumns, Complex[] q, Complex[] work)
{
throw new NotImplementedException();
}
@ -1722,14 +1787,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, Complex[] r, Complex[] q, Complex[] b, Complex[] x)
public void QRSolve(Complex[] r, int rRows, int rColumns, Complex[] q, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -1737,17 +1804,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, Complex[] r, Complex[] q, Complex[] b, Complex[] x, Complex[] work)
public void QRSolve(Complex[] r, int rRows, int rColumns, Complex[] q, Complex[] b, int bColumns, Complex[] x, Complex[] work)
{
throw new NotImplementedException();
}
@ -1755,12 +1824,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex[],Complex[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex[],Complex[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, Complex[] q, Complex[] r, Complex[] b, Complex[] x)
public void QRSolveFactored(Complex[] q, Complex[] r, int rRows, int rColumns, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -1770,13 +1841,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex[] a, Complex[] s, Complex[] u, Complex[] vt)
public void SingularValueDecomposition(bool computeVectors, Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt)
{
throw new NotImplementedException();
}
@ -1786,6 +1859,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -1795,7 +1870,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex[] a, Complex[] s, Complex[] u, Complex[] vt, Complex[] work)
public void SingularValueDecomposition(bool computeVectors, Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] work)
{
throw new NotImplementedException();
}
@ -1804,12 +1879,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(Complex[] a, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, Complex[] x)
public void SvdSolve(Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -1818,15 +1896,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(Complex[] a, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, Complex[] x, Complex[] work)
public void SvdSolve(Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int bColumns, Complex[] x, Complex[] work)
{
throw new NotImplementedException();
}
@ -1834,13 +1915,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex[],Complex[],Complex[],Complex[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingluarValueDecomposition(bool,Complex[],Complex[],Complex[],Complex[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex[],Complex[],Complex[],Complex[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex[],int,int,Complex[],Complex[],Complex[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex[],int,int,Complex[],Complex[],Complex[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex[],int,int,Complex[],Complex[],Complex[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, Complex[] x)
public void SvdSolveFactored(int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -2259,23 +2342,23 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.c_cholesky_factor(order, a);
SafeNativeMethods.c_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
public void CholeskySolve(Complex32[] a, int aOrder, Complex32[] b, int bRows, int bColumns)
{
@ -2288,8 +2371,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(Complex32[] a, int aOrder, Complex32[] b, int bRows, int bColumns)
{
@ -2300,11 +2383,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex32[] r, Complex32[] q)
public void QRFactor(Complex32[] r, int rRows, int rColumns, Complex32[] q)
{
throw new NotImplementedException();
}
@ -2313,13 +2398,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(Complex32[] r, Complex32[] q, Complex32[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex32[] r, int rRows, int rColumns, Complex32[] q, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2327,14 +2415,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x)
public void QRSolve(Complex32[] r, int rRows, int rColumns, Complex32[] q, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}
@ -2342,17 +2432,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x, Complex32[] work)
public void QRSolve(Complex32[] r, int rRows, int rColumns, Complex32[] q, Complex32[] b, int bColumns, Complex32[] x, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2360,12 +2452,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex32[],Complex32[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex32[],Complex32[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex32[],int,int,Complex32[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex32[],int,int,Complex32[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, Complex32[] q, Complex32[] r, Complex32[] b, Complex32[] x)
public void QRSolveFactored(Complex32[] q, Complex32[] r, int rRows, int rColumns, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}
@ -2375,13 +2469,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt)
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt)
{
throw new NotImplementedException();
}
@ -2391,6 +2487,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -2400,7 +2498,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work)
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2409,12 +2507,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x)
public void SvdSolve(Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}
@ -2423,15 +2524,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x, Complex32[] work)
public void SvdSolve(Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int bColumns, Complex32[] x, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2439,13 +2543,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex32[],Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex32[],int,int,Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],int,int,Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],int,int,Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x)
public void SvdSolveFactored(int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}

72
src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProviderOfT.cs

@ -3,9 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009-2010 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
@ -83,7 +81,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// Interface to linear algebra algorithms that work off 1-D arrays.
/// </summary>
/// <typeparam name="T">Supported data types are double, single, <see cref="Complex"/>, and <see cref="Complex32"/>.</typeparam>
public interface ILinearAlgebraProvider<T> where T : struct
public interface ILinearAlgebraProvider<T>
where T : struct
{
/*/// <summary>
/// Queries the provider for the optimal, workspace block size
@ -93,7 +92,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <returns>-1 if the provider cannot compute the workspace size; otherwise
/// the suggested block size.</returns>
int QueryWorkspaceBlockSize(string methodName);*/
/// <summary>
/// Adds a scaled vector to another: <c>y += alpha*x</c>.
/// </summary>
@ -210,9 +209,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="bColumns">The number of columns in the <paramref name="b"/> matrix.</param>
/// <param name="beta">The value to scale the <paramref name="c"/> matrix.</param>
/// <param name="c">The c matrix.</param>
void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, T alpha, T[] a,
int aRows, int aColumns, T[] b, int bRows, int bColumns, T beta, T[] c);
void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, T alpha, T[] a, int aRows, int aColumns, T[] b, int bRows, int bColumns, T beta, T[] c);
/// <summary>
/// Computes the LUP factorization of A. P*A = L*U.
/// </summary>
@ -336,79 +334,93 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// </summary>
/// <param name="r">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. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
void QRFactor(T[] r, T[] q);
void QRFactor(T[] r, int rRows, int rColumns, T[] q);
/// <summary>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
void QRFactor(T[] r, T[] q, T[] work);
void QRFactor(T[] r, int rRows, int rColumns, T[] q, T[] work);
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
void QRSolve(int columnsOfB, T[] r, T[] q, T[] b, T[] x);
void QRSolve(T[] r, int rRows, int rColumns, T[] q, T[] b, int bColumns, T[] x);
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
void QRSolve(int columnsOfB, T[] r, T[] q, T[] b, T[] x, T[] work);
void QRSolve(T[] r, int rRows, int rColumns, T[] q, T[] b, int bColumns, T[] x, T[] work);
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(T[],T[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(T[],T[])"/>. </param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(T[],int,int,T[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(T[],int,int,T[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
void QRSolveFactored(int columnsOfB, T[] q, T[] r, T[] b, T[] x);
void QRSolveFactored(T[] q, T[] r, int rRows, int rColumns, T[] b, int bColumns, T[] x);
/// <summary>
/// Computes the singular value decomposition of A.
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value. </param>
/// <param name="u">If <paramref name="computeVectors"/> is <c>true</c>, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
void SingularValueDecomposition(bool computeVectors, T[] a, T[] s, T[] u, T[] vt);
void SingularValueDecomposition(bool computeVectors, T[] a, int aRows, int aColumns, T[] s, T[] u, T[] vt);
/// <summary>
/// Computes the singular value decomposition of A.
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value. </param>
/// <param name="u">If <paramref name="computeVectors"/> is <c>true</c>, on exit U contains the left
/// singular vectors.</param>
@ -419,43 +431,51 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// On exit, work[0] contains the optimal work size value.
/// </param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
void SingularValueDecomposition(bool computeVectors, T[] a, T[] s, T[] u, T[] vt, T[] work);
void SingularValueDecomposition(bool computeVectors, T[] a, int aRows, int aColumns, T[] s, T[] u, T[] vt, T[] work);
/// <summary>
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value. </param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
void SvdSolve(T[] a, T[] s, T[] u, T[] vt, T[] b, T[] x);
void SvdSolve(T[] a, int aRows, int aColumns, T[] s, T[] u, T[] vt, T[] b, int bColumns, T[] x);
/// <summary>
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value. </param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.
/// </param>
void SvdSolve(T[] a, T[] s, T[] u, T[] vt, T[] b, T[] x, T[] work);
void SvdSolve(T[] a, int aRows, int aColumns, T[] s, T[] u, T[] vt, T[] b, int bColumns, T[] x, T[] work);
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,T[],T[],T[],T[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,T[],T[],T[],T[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,T[],T[],T[],T[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,T[],int,int,T[],T[],T[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,T[],int,int, T[],T[],T[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,T[],int,int,T[],T[],T[],T[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
void SvdSolveFactored(int columnsOfB, T[] s, T[] u, T[] vt, T[] b, T[] x);
void SvdSolveFactored(int aRows, int aColumns, T[] s, T[] u, T[] vt, T[] b, int bColumns, T[] x);
}
}

2626
src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs

File diff suppressed because it is too large

398
src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs

@ -28,7 +28,7 @@
/* This file is automatically generated - do not modify it.
Change NativeLinearAlgebraProvider.include instead.
Last generated on UTC 2010-06-27 13:41:29Z
Last generated on UTC 2010-07-04 13:21:48Z
*/
namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
@ -234,6 +234,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
@ -247,6 +249,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/>
/// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param>
@ -451,24 +455,25 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.d_cholesky_factor(order, a);
SafeNativeMethods.d_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.
/// </remarks>
public void CholeskySolve(double[] a, int aOrder, double[] b, int bRows, int bColumns)
{
throw new NotImplementedException();
@ -480,8 +485,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(double[] a, int aOrder, double[] b, int bRows, int bColumns)
{
@ -492,11 +497,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(double[] r, double[] q)
public void QRFactor(double[] r, int rRows, int rColumns, double[] q)
{
throw new NotImplementedException();
}
@ -505,13 +512,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(double[] r, double[] q, double[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(double[] r, int rRows, int rColumns, double[] q, double[] work)
{
throw new NotImplementedException();
}
@ -519,14 +529,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x)
public void QRSolve(double[] r, int rRows, int rColumns, double[] q, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -534,17 +546,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x, double[] work)
public void QRSolve(double[] r, int rRows, int rColumns, double[] q, double[] b, int bColumns, double[] x, double[] work)
{
throw new NotImplementedException();
}
@ -552,12 +566,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(double[],double[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(double[],double[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(double[],int,int,double[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(double[],int,int,double[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, double[] q, double[] r, double[] b, double[] x)
public void QRSolveFactored(double[] q, double[] r, int rRows, int rColumns, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -567,13 +583,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, double[] a, double[] s, double[] u, double[] vt)
public void SingularValueDecomposition(bool computeVectors, double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt)
{
throw new NotImplementedException();
}
@ -583,6 +601,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -592,7 +612,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, double[] a, double[] s, double[] u, double[] vt, double[] work)
public void SingularValueDecomposition(bool computeVectors, double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] work)
{
throw new NotImplementedException();
}
@ -601,12 +621,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x)
public void SvdSolve(double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -615,15 +638,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x, double[] work)
public void SvdSolve(double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] b, int bColumns, double[] x, double[] work)
{
throw new NotImplementedException();
}
@ -631,13 +657,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,double[],double[],double[],double[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],double[],double[],double[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],double[],double[],double[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,double[],int,int,double[],double[],double[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],int,int,double[],double[],double[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],int,int,double[],double[],double[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, double[] s, double[] u, double[] vt, double[] b, double[] x)
public void SvdSolveFactored(int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -835,6 +863,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
@ -848,6 +878,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/>
/// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param>
@ -925,6 +957,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
SafeNativeMethods.s_matrix_multiply(transposeA, transposeB, m, n, k, alpha, a, b, beta, c);
}
/// <summary>
/// <summary>
/// Computes the LUP factorization of A. P*A = L*U.
/// </summary>
@ -1052,23 +1085,23 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.s_cholesky_factor(order, a);
SafeNativeMethods.s_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
public void CholeskySolve(float[] a, int aOrder, float[] b, int bRows, int bColumns)
{
@ -1081,8 +1114,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(float[] a, int aOrder, float[] b, int bRows, int bColumns)
{
@ -1093,11 +1126,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(float[] r, float[] q)
public void QRFactor(float[] r, int rRows, int rColumns, float[] q)
{
throw new NotImplementedException();
}
@ -1106,13 +1141,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(float[] r, float[] q, float[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(float[] r, int rRows, int rColumns, float[] q, float[] work)
{
throw new NotImplementedException();
}
@ -1120,14 +1158,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, float[] r, float[] q, float[] b, float[] x)
public void QRSolve(float[] r, int rRows, int rColumns, float[] q, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1135,17 +1175,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, float[] r, float[] q, float[] b, float[] x, float[] work)
public void QRSolve(float[] r, int rRows, int rColumns, float[] q, float[] b, int bColumns, float[] x, float[] work)
{
throw new NotImplementedException();
}
@ -1153,12 +1195,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(float[],float[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(float[],float[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(float[],int,int,float[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(float[],int,int,float[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, float[] q, float[] r, float[] b, float[] x)
public void QRSolveFactored(float[] q, float[] r, int rRows, int rColumns, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1168,13 +1212,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, float[] a, float[] s, float[] u, float[] vt)
public void SingularValueDecomposition(bool computeVectors, float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt)
{
throw new NotImplementedException();
}
@ -1184,6 +1230,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -1193,7 +1241,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, float[] a, float[] s, float[] u, float[] vt, float[] work)
public void SingularValueDecomposition(bool computeVectors, float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] work)
{
throw new NotImplementedException();
}
@ -1202,12 +1250,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(float[] a, float[] s, float[] u, float[] vt, float[] b, float[] x)
public void SvdSolve(float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1216,15 +1267,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(float[] a, float[] s, float[] u, float[] vt, float[] b, float[] x, float[] work)
public void SvdSolve(float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] b, int bColumns, float[] x, float[] work)
{
throw new NotImplementedException();
}
@ -1232,13 +1286,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,float[],float[],float[],float[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],float[],float[],float[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],float[],float[],float[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,float[],int,int,float[],float[],float[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],int,int,float[],float[],float[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],int,int,float[],float[],float[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, float[] s, float[] u, float[] vt, float[] b, float[] x)
public void SvdSolveFactored(int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1436,6 +1492,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
@ -1449,6 +1507,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/>
/// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param>
@ -1653,23 +1713,23 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.z_cholesky_factor(order, a);
SafeNativeMethods.z_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
public void CholeskySolve(Complex[] a, int aOrder, Complex[] b, int bRows, int bColumns)
{
@ -1682,8 +1742,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(Complex[] a, int aOrder, Complex[] b, int bRows, int bColumns)
{
@ -1694,11 +1754,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex[] r, Complex[] q)
public void QRFactor(Complex[] r, int rRows, int rColumns, Complex[] q)
{
throw new NotImplementedException();
}
@ -1707,13 +1769,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(Complex[] r, Complex[] q, Complex[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex[] r, int rRows, int rColumns, Complex[] q, Complex[] work)
{
throw new NotImplementedException();
}
@ -1721,14 +1786,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, Complex[] r, Complex[] q, Complex[] b, Complex[] x)
public void QRSolve(Complex[] r, int rRows, int rColumns, Complex[] q, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -1736,17 +1803,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, Complex[] r, Complex[] q, Complex[] b, Complex[] x, Complex[] work)
public void QRSolve(Complex[] r, int rRows, int rColumns, Complex[] q, Complex[] b, int bColumns, Complex[] x, Complex[] work)
{
throw new NotImplementedException();
}
@ -1754,12 +1823,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex[],Complex[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex[],Complex[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, Complex[] q, Complex[] r, Complex[] b, Complex[] x)
public void QRSolveFactored(Complex[] q, Complex[] r, int rRows, int rColumns, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -1769,13 +1840,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex[] a, Complex[] s, Complex[] u, Complex[] vt)
public void SingularValueDecomposition(bool computeVectors, Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt)
{
throw new NotImplementedException();
}
@ -1785,6 +1858,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -1794,7 +1869,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex[] a, Complex[] s, Complex[] u, Complex[] vt, Complex[] work)
public void SingularValueDecomposition(bool computeVectors, Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] work)
{
throw new NotImplementedException();
}
@ -1803,12 +1878,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(Complex[] a, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, Complex[] x)
public void SvdSolve(Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -1817,15 +1895,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(Complex[] a, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, Complex[] x, Complex[] work)
public void SvdSolve(Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int bColumns, Complex[] x, Complex[] work)
{
throw new NotImplementedException();
}
@ -1833,13 +1914,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex[],Complex[],Complex[],Complex[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingluarValueDecomposition(bool,Complex[],Complex[],Complex[],Complex[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex[],Complex[],Complex[],Complex[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex[],int,int,Complex[],Complex[],Complex[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex[],int,int,Complex[],Complex[],Complex[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex[],int,int,Complex[],Complex[],Complex[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, Complex[] x)
public void SvdSolveFactored(int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -2258,23 +2341,23 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.c_cholesky_factor(order, a);
SafeNativeMethods.c_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
public void CholeskySolve(Complex32[] a, int aOrder, Complex32[] b, int bRows, int bColumns)
{
@ -2287,8 +2370,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(Complex32[] a, int aOrder, Complex32[] b, int bRows, int bColumns)
{
@ -2299,11 +2382,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex32[] r, Complex32[] q)
public void QRFactor(Complex32[] r, int rRows, int rColumns, Complex32[] q)
{
throw new NotImplementedException();
}
@ -2312,13 +2397,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(Complex32[] r, Complex32[] q, Complex32[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex32[] r, int rRows, int rColumns, Complex32[] q, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2326,14 +2414,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x)
public void QRSolve(Complex32[] r, int rRows, int rColumns, Complex32[] q, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}
@ -2341,17 +2431,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x, Complex32[] work)
public void QRSolve(Complex32[] r, int rRows, int rColumns, Complex32[] q, Complex32[] b, int bColumns, Complex32[] x, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2359,12 +2451,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex32[],Complex32[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex32[],Complex32[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex32[],int,int,Complex32[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex32[],int,int,Complex32[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, Complex32[] q, Complex32[] r, Complex32[] b, Complex32[] x)
public void QRSolveFactored(Complex32[] q, Complex32[] r, int rRows, int rColumns, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}
@ -2374,13 +2468,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt)
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt)
{
throw new NotImplementedException();
}
@ -2390,6 +2486,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -2399,7 +2497,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work)
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2408,12 +2506,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x)
public void SvdSolve(Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}
@ -2422,15 +2523,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x, Complex32[] work)
public void SvdSolve(Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int bColumns, Complex32[] x, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2438,13 +2542,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex32[],Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex32[],int,int,Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],int,int,Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],int,int,Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x)
public void SvdSolveFactored(int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}

396
src/Numerics/Algorithms/LinearAlgebra/NativeAlgebraProvider.include

@ -249,6 +249,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
@ -262,6 +264,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/>
/// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param>
@ -466,24 +470,25 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.d_cholesky_factor(order, a);
SafeNativeMethods.d_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.
/// </remarks>
public void CholeskySolve(double[] a, int aOrder, double[] b, int bRows, int bColumns)
{
throw new NotImplementedException();
@ -495,8 +500,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(double[] a, int aOrder, double[] b, int bRows, int bColumns)
{
@ -507,11 +512,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(double[] r, double[] q)
public void QRFactor(double[] r, int rRows, int rColumns, double[] q)
{
throw new NotImplementedException();
}
@ -520,13 +527,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(double[] r, double[] q, double[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(double[] r, int rRows, int rColumns, double[] q, double[] work)
{
throw new NotImplementedException();
}
@ -534,14 +544,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x)
public void QRSolve(double[] r, int rRows, int rColumns, double[] q, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -549,17 +561,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x, double[] work)
public void QRSolve(double[] r, int rRows, int rColumns, double[] q, double[] b, int bColumns, double[] x, double[] work)
{
throw new NotImplementedException();
}
@ -567,12 +581,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(double[],double[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(double[],double[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(double[],int,int,double[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(double[],int,int,double[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, double[] q, double[] r, double[] b, double[] x)
public void QRSolveFactored(double[] q, double[] r, int rRows, int rColumns, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -582,13 +598,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, double[] a, double[] s, double[] u, double[] vt)
public void SingularValueDecomposition(bool computeVectors, double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt)
{
throw new NotImplementedException();
}
@ -598,6 +616,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -607,7 +627,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, double[] a, double[] s, double[] u, double[] vt, double[] work)
public void SingularValueDecomposition(bool computeVectors, double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] work)
{
throw new NotImplementedException();
}
@ -616,12 +636,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x)
public void SvdSolve(double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -630,15 +653,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x, double[] work)
public void SvdSolve(double[] a, int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] b, int bColumns, double[] x, double[] work)
{
throw new NotImplementedException();
}
@ -646,13 +672,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,double[],double[],double[],double[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],double[],double[],double[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],double[],double[],double[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,double[],int,int,double[],double[],double[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],int,int,double[],double[],double[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,double[],int,int,double[],double[],double[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, double[] s, double[] u, double[] vt, double[] b, double[] x)
public void SvdSolveFactored(int aRows, int aColumns, double[] s, double[] u, double[] vt, double[] b, int bColumns, double[] x)
{
throw new NotImplementedException();
}
@ -862,6 +890,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
@ -875,6 +905,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/>
/// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param>
@ -952,6 +984,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
SafeNativeMethods.s_matrix_multiply(transposeA, transposeB, m, n, k, alpha, a, b, beta, c);
}
/// <summary>
/// <summary>
/// Computes the LUP factorization of A. P*A = L*U.
/// </summary>
@ -1079,23 +1112,23 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.s_cholesky_factor(order, a);
SafeNativeMethods.s_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
public void CholeskySolve(float[] a, int aOrder, float[] b, int bRows, int bColumns)
{
@ -1108,8 +1141,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(float[] a, int aOrder, float[] b, int bRows, int bColumns)
{
@ -1120,11 +1153,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(float[] r, float[] q)
public void QRFactor(float[] r, int rRows, int rColumns, float[] q)
{
throw new NotImplementedException();
}
@ -1133,13 +1168,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(float[] r, float[] q, float[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(float[] r, int rRows, int rColumns, float[] q, float[] work)
{
throw new NotImplementedException();
}
@ -1147,14 +1185,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, float[] r, float[] q, float[] b, float[] x)
public void QRSolve(float[] r, int rRows, int rColumns, float[] q, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1162,17 +1202,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, float[] r, float[] q, float[] b, float[] x, float[] work)
public void QRSolve(float[] r, int rRows, int rColumns, float[] q, float[] b, int bColumns, float[] x, float[] work)
{
throw new NotImplementedException();
}
@ -1180,12 +1222,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(float[],float[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(float[],float[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(float[],int,int,float[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(float[],int,int,float[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, float[] q, float[] r, float[] b, float[] x)
public void QRSolveFactored(float[] q, float[] r, int rRows, int rColumns, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1195,13 +1239,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, float[] a, float[] s, float[] u, float[] vt)
public void SingularValueDecomposition(bool computeVectors, float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt)
{
throw new NotImplementedException();
}
@ -1211,6 +1257,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -1220,7 +1268,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, float[] a, float[] s, float[] u, float[] vt, float[] work)
public void SingularValueDecomposition(bool computeVectors, float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] work)
{
throw new NotImplementedException();
}
@ -1229,12 +1277,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(float[] a, float[] s, float[] u, float[] vt, float[] b, float[] x)
public void SvdSolve(float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1243,15 +1294,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(float[] a, float[] s, float[] u, float[] vt, float[] b, float[] x, float[] work)
public void SvdSolve(float[] a, int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] b, int bColumns, float[] x, float[] work)
{
throw new NotImplementedException();
}
@ -1259,13 +1313,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,float[],float[],float[],float[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],float[],float[],float[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],float[],float[],float[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,float[],int,int,float[],float[],float[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],int,int,float[],float[],float[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,float[],int,int,float[],float[],float[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, float[] s, float[] u, float[] vt, float[] b, float[] x)
public void SvdSolveFactored(int aRows, int aColumns, float[] s, float[] u, float[] vt, float[] b, int bColumns, float[] x)
{
throw new NotImplementedException();
}
@ -1475,6 +1531,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
@ -1488,6 +1546,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the requested <see cref="Norm"/> of the matrix.
/// </summary>
/// <param name="norm">The type of norm to compute.</param>
/// <param name="rows">The number of rows in the matrix.</param>
/// <param name="columns">The number of columns in the matrix.</param>
/// <param name="matrix">The matrix to compute the norm from.</param>
/// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/>
/// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param>
@ -1692,23 +1752,23 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.z_cholesky_factor(order, a);
SafeNativeMethods.z_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
public void CholeskySolve(Complex[] a, int aOrder, Complex[] b, int bRows, int bColumns)
{
@ -1721,8 +1781,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(Complex[] a, int aOrder, Complex[] b, int bRows, int bColumns)
{
@ -1733,11 +1793,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex[] r, Complex[] q)
public void QRFactor(Complex[] r, int rRows, int rColumns, Complex[] q)
{
throw new NotImplementedException();
}
@ -1746,13 +1808,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(Complex[] r, Complex[] q, Complex[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex[] r, int rRows, int rColumns, Complex[] q, Complex[] work)
{
throw new NotImplementedException();
}
@ -1760,14 +1825,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, Complex[] r, Complex[] q, Complex[] b, Complex[] x)
public void QRSolve(Complex[] r, int rRows, int rColumns, Complex[] q, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -1775,17 +1842,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, Complex[] r, Complex[] q, Complex[] b, Complex[] x, Complex[] work)
public void QRSolve(Complex[] r, int rRows, int rColumns, Complex[] q, Complex[] b, int bColumns, Complex[] x, Complex[] work)
{
throw new NotImplementedException();
}
@ -1793,12 +1862,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex[],Complex[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex[],Complex[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, Complex[] q, Complex[] r, Complex[] b, Complex[] x)
public void QRSolveFactored(Complex[] q, Complex[] r, int rRows, int rColumns, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -1808,13 +1879,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex[] a, Complex[] s, Complex[] u, Complex[] vt)
public void SingularValueDecomposition(bool computeVectors, Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt)
{
throw new NotImplementedException();
}
@ -1824,6 +1897,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -1833,7 +1908,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex[] a, Complex[] s, Complex[] u, Complex[] vt, Complex[] work)
public void SingularValueDecomposition(bool computeVectors, Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] work)
{
throw new NotImplementedException();
}
@ -1842,12 +1917,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(Complex[] a, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, Complex[] x)
public void SvdSolve(Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -1856,15 +1934,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(Complex[] a, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, Complex[] x, Complex[] work)
public void SvdSolve(Complex[] a, int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int bColumns, Complex[] x, Complex[] work)
{
throw new NotImplementedException();
}
@ -1872,13 +1953,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex[],Complex[],Complex[],Complex[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingluarValueDecomposition(bool,Complex[],Complex[],Complex[],Complex[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex[],Complex[],Complex[],Complex[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex[],int,int,Complex[],Complex[],Complex[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex[],int,int,Complex[],Complex[],Complex[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex[],int,int,Complex[],Complex[],Complex[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, Complex[] x)
public void SvdSolveFactored(int aRows, int aColumns, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int bColumns, Complex[] x)
{
throw new NotImplementedException();
}
@ -2309,23 +2392,23 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
{
throw new ArgumentNullException("a");
}
if ( order < 1)
if (order < 1)
{
throw new ArgumentException(Properties.Resources.ArgumentMustBePositive, "order");
throw new ArgumentException(Resources.ArgumentMustBePositive, "order");
}
SafeNativeMethods.c_cholesky_factor(order, a);
SafeNativeMethods.c_cholesky_factor(order, a);
}
/// <summary>
/// Solves A*X=B for X using Cholesky factorization.
/// </summary>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines.</remarks>
public void CholeskySolve(Complex32[] a, int aOrder, Complex32[] b, int bRows, int bColumns)
{
@ -2338,8 +2421,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <param name="a">The square, positive definite matrix A.</param>
/// <param name="aOrder">The number of rows and columns in A.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <param name="bRows">The number of rows in the B matrix.</param>
/// <param name="bColumns">The number of columns in the B matrix.</param>
/// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks>
public void CholeskySolveFactored(Complex32[] a, int aOrder, Complex32[] b, int bRows, int bColumns)
{
@ -2350,11 +2433,13 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex32[] r, Complex32[] q)
public void QRFactor(Complex32[] r, int rRows, int rColumns, Complex32[] q)
{
throw new NotImplementedException();
}
@ -2363,13 +2448,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRFactor(Complex32[] r, Complex32[] q, Complex32[] work)
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
public void QRFactor(Complex32[] r, int rRows, int rColumns, Complex32[] q, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2377,14 +2465,16 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x)
public void QRSolve(Complex32[] r, int rRows, int rColumns, Complex32[] q, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}
@ -2392,17 +2482,19 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="r">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.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x, Complex32[] work)
public void QRSolve(Complex32[] r, int rRows, int rColumns, Complex32[] q, Complex32[] b, int bColumns, Complex32[] x, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2410,12 +2502,14 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using a previously QR factored matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex32[],Complex32[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex32[],Complex32[])"/>.</param>
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex32[],int,int,Complex32[])"/>.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex32[],int,int,Complex32[])"/>. </param>
/// <param name="rRows">The number of rows in the A matrix.</param>
/// <param name="rColumns">The number of columns in the A matrix.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(int columnsOfB, Complex32[] q, Complex32[] r, Complex32[] b, Complex32[] x)
public void QRSolveFactored(Complex32[] q, Complex32[] r, int rRows, int rColumns, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}
@ -2425,13 +2519,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is true, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt)
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt)
{
throw new NotImplementedException();
}
@ -2441,6 +2537,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is true, on exit U contains the left
/// singular vectors.</param>
@ -2450,7 +2548,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work)
public void SingularValueDecomposition(bool computeVectors, Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2459,12 +2557,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x)
public void SvdSolve(Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}
@ -2473,15 +2574,18 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// Solves A*X=B for X using the singular value decomposition of A.
/// </summary>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">On exit U contains the left singular vectors.</param>
/// <param name="vt">On exit VT contains the transposed right singular vectors.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array. For real matrices, the work array should be at least
/// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N).
/// On exit, work[0] contains the optimal work size value.</param>
public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x, Complex32[] work)
public void SvdSolve(Complex32[] a, int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int bColumns, Complex32[] x, Complex32[] work)
{
throw new NotImplementedException();
}
@ -2489,13 +2593,15 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
/// <summary>
/// Solves A*X=B for X using a previously SVD decomposed matrix.
/// </summary>
/// <param name="columnsOfB">The number of columns of B.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex32[],Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="aRows">The number of rows in the A matrix.</param>
/// <param name="aColumns">The number of columns in the A matrix.</param>
/// <param name="s">The s values returned by <see cref="SingularValueDecomposition(bool,Complex32[],int,int,Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="u">The left singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],int,int,Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="vt">The right singular vectors returned by <see cref="SingularValueDecomposition(bool,Complex32[],int,int,Complex32[],Complex32[],Complex32[])"/>.</param>
/// <param name="b">The B matrix.</param>
/// <param name="bColumns">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int columnsOfB, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x)
public void SvdSolveFactored(int aRows, int aColumns, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int bColumns, Complex32[] x)
{
throw new NotImplementedException();
}

23
src/Numerics/LinearAlgebra/Double/Factorization/DenseQR.cs

@ -32,7 +32,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
{
using System;
using Properties;
using Threading;
/// <summary>
/// <para>A class which encapsulates the functionality of the QR decomposition.</para>
@ -65,7 +64,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
MatrixR = matrix.Clone();
MatrixQ = new DenseMatrix(matrix.RowCount);
Control.LinearAlgebraProvider.QRFactor(((DenseMatrix)MatrixR).Data, ((DenseMatrix)MatrixQ).Data);
Control.LinearAlgebraProvider.QRFactor(((DenseMatrix)MatrixR).Data, matrix.RowCount, matrix.ColumnCount, ((DenseMatrix)MatrixQ).Data);
}
/// <summary>
@ -116,18 +115,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
throw new NotImplementedException("Can only do QR factorization for dense matrices at the moment.");
}
var solution = new double[dinput.Data.Length];
Control.LinearAlgebraProvider.QRSolveFactored(input.ColumnCount, ((DenseMatrix)MatrixQ).Data, ((DenseMatrix)MatrixR).Data, dinput.Data, solution);
CommonParallel.For(
0,
dresult.RowCount,
row =>
{
for (var col = 0; col < dresult.ColumnCount; col++)
{
dresult[row, col] = solution[row + (col * dinput.RowCount)];
}
});
Control.LinearAlgebraProvider.QRSolveFactored(((DenseMatrix)MatrixQ).Data, ((DenseMatrix)MatrixR).Data, MatrixR.RowCount, MatrixR.ColumnCount, dinput.Data, input.ColumnCount, dresult.Data);
}
/// <summary>
@ -172,12 +160,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
throw new NotImplementedException("Can only do QR factorization for dense vectors at the moment.");
}
var solution = new double[dinput.Data.Length];
Control.LinearAlgebraProvider.QRSolveFactored(1, ((DenseMatrix)MatrixQ).Data, ((DenseMatrix)MatrixR).Data, dinput.Data, solution);
CommonParallel.For(
0,
dresult.Count,
index => { dresult[index] = solution[index]; });
Control.LinearAlgebraProvider.QRSolveFactored(((DenseMatrix)MatrixQ).Data, ((DenseMatrix)MatrixR).Data, MatrixR.RowCount, MatrixR.ColumnCount, dinput.Data, 1, dresult.Data);
}
}
}

180
src/Numerics/LinearAlgebra/Double/Factorization/DenseSvd.cs

@ -0,0 +1,180 @@
// <copyright file="DenseSvd.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009-2010 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
{
using System;
using Properties;
/// <summary>
/// <para>A class which encapsulates the functionality of the singular value decomposition (SVD) for <see cref="DenseMatrix"/>.</para>
/// <para>Suppose M is an m-by-n matrix whose entries are real numbers.
/// Then there exists a factorization of the form M = UΣVT where:
/// - U is an m-by-m unitary matrix;
/// - Σ is m-by-n diagonal matrix with nonnegative real numbers on the diagonal;
/// - VT denotes transpose of V, an n-by-n unitary matrix;
/// Such a factorization is called a singular-value decomposition of M. A common convention is to order the diagonal
/// entries Σ(i,i) in descending order. In this case, the diagonal matrix Σ is uniquely determined
/// by M (though the matrices U and V are not). The diagonal entries of Σ are known as the singular values of M.</para>
/// </summary>
/// <remarks>
/// The computation of the singular value decomposition is done at construction time.
/// </remarks>
public class DenseSvd : Svd
{
/// <summary>
/// Initializes a new instance of the <see cref="DenseSvd"/> class. This object will compute the
/// the singular value decomposition when the constructor is called and cache it's decomposition.
/// </summary>
/// <param name="matrix">The matrix to factor.</param>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <exception cref="ArgumentNullException">If <paramref name="matrix"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException">If SVD algorithm failed to converge with matrix <paramref name="matrix"/>.</exception>
public DenseSvd(DenseMatrix matrix, bool computeVectors)
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
}
ComputeVectors = computeVectors;
var nm = Math.Min(matrix.RowCount, matrix.ColumnCount);
VectorS = new DenseVector(nm);
MatrixU = new DenseMatrix(matrix.RowCount);
MatrixVT = new DenseMatrix(matrix.ColumnCount);
Control.LinearAlgebraProvider.SingularValueDecomposition(computeVectors, ((DenseMatrix)matrix.Clone()).Data, matrix.RowCount, matrix.ColumnCount, ((DenseVector)VectorS).Data, ((DenseMatrix)MatrixU).Data, ((DenseMatrix)MatrixVT).Data);
}
/// <summary>
/// Solves a system of linear equations, <b>AX = B</b>, with A SVD factorized.
/// </summary>
/// <param name="input">The right hand side <see cref="Matrix"/>, <b>B</b>.</param>
/// <param name="result">The left hand side <see cref="Matrix"/>, <b>X</b>.</param>
public override void Solve(Matrix input, Matrix result)
{
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
}
if (result == null)
{
throw new ArgumentNullException("result");
}
if (!ComputeVectors)
{
throw new InvalidOperationException(Resources.SingularVectorsNotComputed);
}
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (MatrixU.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
}
// The solution X row dimension is equal to the column dimension of A
if (MatrixVT.ColumnCount != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
}
var dinput = input as DenseMatrix;
if (dinput == null)
{
throw new NotImplementedException("Can only do SVD factorization for dense matrices at the moment.");
}
var dresult = result as DenseMatrix;
if (dresult == null)
{
throw new NotImplementedException("Can only do SVD factorization for dense matrices at the moment.");
}
Control.LinearAlgebraProvider.SvdSolveFactored(MatrixU.RowCount, MatrixVT.ColumnCount, ((DenseVector)VectorS).Data, ((DenseMatrix)MatrixU).Data, ((DenseMatrix)MatrixVT).Data, dinput.Data, input.ColumnCount, dresult.Data);
}
/// <summary>
/// Solves a system of linear equations, <b>Ax = b</b>, with A SVD factorized.
/// </summary>
/// <param name="input">The right hand side vector, <b>b</b>.</param>
/// <param name="result">The left hand side <see cref="Matrix"/>, <b>x</b>.</param>
public override void Solve(Vector input, Vector result)
{
if (input == null)
{
throw new ArgumentNullException("input");
}
if (result == null)
{
throw new ArgumentNullException("result");
}
if (!ComputeVectors)
{
throw new InvalidOperationException(Resources.SingularVectorsNotComputed);
}
// Ax=b where A is an m x n matrix
// Check that b is a column vector with m entries
if (MatrixU.RowCount != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
}
// Check that x is a column vector with n entries
if (MatrixVT.ColumnCount != result.Count)
{
throw new ArgumentException(Resources.ArgumentMatrixDimensions);
}
var dinput = input as DenseVector;
if (dinput == null)
{
throw new NotImplementedException("Can only do QR factorization for dense vectors at the moment.");
}
var dresult = result as DenseVector;
if (dresult == null)
{
throw new NotImplementedException("Can only do QR factorization for dense vectors at the moment.");
}
Control.LinearAlgebraProvider.SvdSolveFactored(MatrixU.RowCount, MatrixVT.ColumnCount, ((DenseVector)VectorS).Data, ((DenseMatrix)MatrixU).Data, ((DenseMatrix)MatrixVT).Data, dinput.Data, 1, dresult.Data);
}
}
}

11
src/Numerics/LinearAlgebra/Double/Factorization/ExtensionMethods.cs

@ -64,5 +64,16 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
{
return Factorization.QR.Create(matrix);
}
/// <summary>
/// Computes the SVD decomposition for a matrix.
/// </summary>
/// <param name="matrix">The matrix to factor.</param>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <returns>The QR decomposition object.</returns>
public static Svd Svd(this Matrix matrix, bool computeVectors)
{
return Factorization.Svd.Create(matrix, computeVectors);
}
}
}

4
src/Numerics/LinearAlgebra/Double/Factorization/QR.cs

@ -77,11 +77,11 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
/// <summary>
/// Gets orthogonal Q matrix
/// </summary>
public virtual Matrix Q
public virtual Matrix Q
{
get
{
return MatrixQ;
return MatrixQ.Clone();
}
}

283
src/Numerics/LinearAlgebra/Double/Factorization/Svd.cs

@ -0,0 +1,283 @@
// <copyright file="Svd.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009-2010 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
{
using System;
using Properties;
/// <summary>
/// <para>A class which encapsulates the functionality of the singular value decomposition (SVD).</para>
/// <para>Suppose M is an m-by-n matrix whose entries are real numbers.
/// Then there exists a factorization of the form M = UΣVT where:
/// - U is an m-by-m unitary matrix;
/// - Σ is m-by-n diagonal matrix with nonnegative real numbers on the diagonal;
/// - VT denotes transpose of V, an n-by-n unitary matrix;
/// Such a factorization is called a singular-value decomposition of M. A common convention is to order the diagonal
/// entries Σ(i,i) in descending order. In this case, the diagonal matrix Σ is uniquely determined
/// by M (though the matrices U and V are not). The diagonal entries of Σ are known as the singular values of M.</para>
/// </summary>
/// <remarks>
/// The computation of the singular value decomposition is done at construction time.
/// </remarks>
public abstract class Svd : ISolver
{
/// <summary>
/// Gets or sets a value indicating whether to compute U and VT matrices during SVD factorization or not
/// </summary>
protected bool ComputeVectors
{
get;
set;
}
/// <summary>
/// Gets or sets the singular values (Σ) of matrix in ascending value.
/// </summary>
protected Vector VectorS
{
get;
set;
}
/// <summary>
/// Gets or sets left singular vectors (U - m-by-m unitary matrix)
/// </summary>
protected Matrix MatrixU
{
get;
set;
}
/// <summary>
/// Gets or sets transpose right singular vectors (transpose of V, an n-by-n unitary matrix
/// </summary>
protected Matrix MatrixVT
{
get;
set;
}
/// <summary>
/// Gets the effective numerical matrix rank.
/// </summary>
/// <value>The number of non-negligible singular values.</value>
public virtual int Rank
{
get
{
var eps = Math.Pow(2.0, -52.0);
var tol = Math.Max(MatrixU.RowCount, MatrixVT.ColumnCount) * VectorS[0] * eps;
var nm = Math.Min(MatrixU.RowCount, MatrixVT.ColumnCount);
var rank = 0;
for (var h = 0; h < nm; h++)
{
if (VectorS[h] > tol)
{
rank++;
}
}
return rank;
}
}
/// <summary>
/// Internal method which routes the call to perform the singular value decomposition to the appropriate class.
/// </summary>
/// <param name="matrix">The matrix to factor.</param>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <returns>An SVD object.</returns>
internal static Svd Create(Matrix matrix, bool computeVectors)
{
var dense = matrix as DenseMatrix;
if (dense != null)
{
return new DenseSvd(dense, computeVectors);
}
throw new NotImplementedException();
}
/// <summary>
/// Gets the two norm of the <see cref="Matrix"/>.
/// </summary>
/// <returns>The 2-norm of the <see cref="Matrix"/>.</returns>
public virtual double Norm2
{
get
{
return VectorS[0];
}
}
/// <summary>
/// Gets the condition number <b>max(S) / min(S)</b>
/// </summary>
/// <returns>The condition number.</returns>
public virtual double ConditionNumber
{
get
{
var tmp = Math.Min(MatrixU.RowCount, MatrixVT.ColumnCount) - 1;
return VectorS[0] / VectorS[tmp];
}
}
/// <summary>
/// Gets the determinant of the square matrix for which the SVD was computed.
/// </summary>
public virtual double Determinant
{
get
{
if (MatrixU.RowCount != MatrixVT.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
}
var det = 1.0;
for (var i = 0; i < VectorS.Count; i++)
{
det *= VectorS[i];
if (Math.Abs(VectorS[i]).AlmostEqualInDecimalPlaces(0.0, 15))
{
return 0;
}
}
return Math.Abs(det);
}
}
/// <summary>Returns the left singular vectors as a <see cref="Matrix"/>.</summary>
/// <returns>The left singular vectors. The matrix will be <c>null</c>, if <b>computeVectors</b> in the constructor is set to <c>false</c>.</returns>
public Matrix U()
{
return ComputeVectors ? MatrixU.Clone() : null;
}
/// <summary>Returns the right singular vectors as a <see cref="Matrix"/>.</summary>
/// <returns>The right singular vectors. The matrix will be <c>null</c>, if <b>computeVectors</b> in the constructor is set to <c>false</c>.</returns>
/// <remarks>This is the transpose of the V matrix.</remarks>
public Matrix VT()
{
return ComputeVectors ? MatrixVT.Clone() : null;
}
/// <summary>Returns the singular values as a diagonal <see cref="Matrix"/>.</summary>
/// <returns>The singular values as a diagonal <see cref="Matrix"/>.</returns>
public Matrix W()
{
var rows = MatrixU.RowCount;
var columns = MatrixVT.ColumnCount;
var result = MatrixU.CreateMatrix(rows, columns);
for (var i = 0; i < rows; i++)
{
for (var j = 0; j < columns; j++)
{
if (i == j)
{
result.At(i, i, VectorS[i]);
}
}
}
return result;
}
/// <summary>Returns the singular values as a <see cref="Vector"/>.</summary>
/// <returns>the singular values as a <see cref="Vector"/>.</returns>
public Vector S()
{
return VectorS.Clone();
}
/// <summary>
/// Solves a system of linear equations, <b>AX = B</b>, with A SVD factorized.
/// </summary>
/// <param name="input">The right hand side <see cref="Matrix"/>, <b>B</b>.</param>
/// <returns>The left hand side <see cref="Matrix"/>, <b>X</b>.</returns>
public virtual Matrix Solve(Matrix input)
{
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
}
if (!ComputeVectors)
{
throw new InvalidOperationException(Resources.SingularVectorsNotComputed);
}
Matrix result = MatrixU.CreateMatrix(MatrixVT.ColumnCount, input.ColumnCount);
Solve(input, result);
return result;
}
/// <summary>
/// Solves a system of linear equations, <b>AX = B</b>, with A SVD factorized.
/// </summary>
/// <param name="input">The right hand side <see cref="Matrix"/>, <b>B</b>.</param>
/// <param name="result">The left hand side <see cref="Matrix"/>, <b>X</b>.</param>
public abstract void Solve(Matrix input, Matrix result);
/// <summary>
/// Solves a system of linear equations, <b>Ax = b</b>, with A SVD factorized.
/// </summary>
/// <param name="input">The right hand side vector, <b>b</b>.</param>
/// <returns>The left hand side <see cref="Vector"/>, <b>x</b>.</returns>
public virtual Vector Solve(Vector input)
{
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
}
if (!ComputeVectors)
{
throw new InvalidOperationException(Resources.SingularVectorsNotComputed);
}
var x = MatrixU.CreateVector(MatrixVT.ColumnCount);
Solve(input, x);
return x;
}
/// <summary>
/// Solves a system of linear equations, <b>Ax = b</b>, with A SVD factorized.
/// </summary>
/// <param name="input">The right hand side vector, <b>b</b>.</param>
/// <param name="result">The left hand side <see cref="Matrix"/>, <b>x</b>.</param>
public abstract void Solve(Vector input, Vector result);
}
}

2
src/Numerics/Numerics.csproj

@ -102,8 +102,10 @@
<Compile Include="Control.cs" />
<Compile Include="Complex32.cs" />
<Compile Include="LinearAlgebra\Double\Factorization\DenseQR.cs" />
<Compile Include="LinearAlgebra\Double\Factorization\DenseSvd.cs" />
<Compile Include="LinearAlgebra\Double\ISolver.cs" />
<Compile Include="LinearAlgebra\Double\Factorization\QR.cs" />
<Compile Include="LinearAlgebra\Double\Factorization\Svd.cs" />
<Compile Include="LinearAlgebra\Double\SparseMatrix.cs" />
<Compile Include="Permutation.cs" />
<Compile Include="Distributions\Continuous\Beta.cs" />

18
src/Numerics/Properties/Resources.Designer.cs

@ -465,6 +465,15 @@ namespace MathNet.Numerics.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to An algorithm failed to converge..
/// </summary>
internal static string ConvergenceFailed {
get {
return ResourceManager.GetString("ConvergenceFailed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This feature is not implemented yet (but is planned)..
/// </summary>
@ -591,6 +600,15 @@ namespace MathNet.Numerics.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to The singular vectors were not computed..
/// </summary>
internal static string SingularVectorsNotComputed {
get {
return ResourceManager.GetString("SingularVectorsNotComputed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This special case is not supported yet (but is planned)..
/// </summary>

6
src/Numerics/Properties/Resources.resx

@ -303,4 +303,10 @@
<data name="PermutationAsIntArrayInvalid" xml:space="preserve">
<value>The integer array does not represent a valid permutation.</value>
</data>
<data name="ConvergenceFailed" xml:space="preserve">
<value>An algorithm failed to converge.</value>
</data>
<data name="SingularVectorsNotComputed" xml:space="preserve">
<value>The singular vectors were not computed.</value>
</data>
</root>

6
src/Silverlight/Silverlight.csproj

@ -233,6 +233,9 @@
<Compile Include="..\Numerics\LinearAlgebra\Double\Factorization\DenseQR.cs">
<Link>LinearAlgebra\Double\Factorization\DenseQR.cs</Link>
</Compile>
<Compile Include="..\Numerics\LinearAlgebra\Double\Factorization\DenseSvd.cs">
<Link>LinearAlgebra\Double\Factorization\DenseSvd.cs</Link>
</Compile>
<Compile Include="..\Numerics\LinearAlgebra\Double\Factorization\ExtensionMethods.cs">
<Link>LinearAlgebra\Double\Factorization\ExtensionMethods.cs</Link>
</Compile>
@ -242,6 +245,9 @@
<Compile Include="..\Numerics\LinearAlgebra\Double\Factorization\QR.cs">
<Link>LinearAlgebra\Double\Factorization\QR.cs</Link>
</Compile>
<Compile Include="..\Numerics\LinearAlgebra\Double\Factorization\Svd.cs">
<Link>LinearAlgebra\Double\Factorization\Svd.cs</Link>
</Compile>
<Compile Include="..\Numerics\LinearAlgebra\Double\ISolver.cs">
<Link>LinearAlgebra\Double\ISolver.cs</Link>
</Compile>

370
src/UnitTests/LinearAlgebraTests/Double/Factorization/SvdTests.cs

@ -0,0 +1,370 @@
// <copyright file="SvdTests.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009-2010 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.Factorization
{
using System;
using MbUnit.Framework;
using LinearAlgebra.Double;
using LinearAlgebra.Double.Factorization;
public class SvdTests
{
[Test]
[ExpectedArgumentNullException]
public void ConstructorNull()
{
new DenseSvd(null, true);
}
[Test]
[Row(1)]
[Row(10)]
[Row(100)]
public void CanFactorizeIdentity(int order)
{
var I = DenseMatrix.Identity(order);
var factorSvd = I.Svd(true);
Assert.AreEqual(I.RowCount, factorSvd.U().RowCount);
Assert.AreEqual(I.RowCount, factorSvd.U().ColumnCount);
Assert.AreEqual(I.ColumnCount, factorSvd.VT().RowCount);
Assert.AreEqual(I.ColumnCount, factorSvd.VT().ColumnCount);
Assert.AreEqual(I.RowCount, factorSvd.W().RowCount);
Assert.AreEqual(I.ColumnCount, factorSvd.W().ColumnCount);
for (var i = 0; i < factorSvd.W().RowCount; i++)
{
for (var j = 0; j < factorSvd.W().ColumnCount; j++)
{
Assert.AreEqual(i == j ? 1.0 : 0.0, factorSvd.W()[i, j]);
}
}
}
[Test]
[Row(1,1)]
[Row(2,2)]
[Row(5,5)]
[Row(10,6)]
[Row(48,52)]
[Row(100,93)]
[MultipleAsserts]
public void CanFactorizeRandomMatrix(int row, int column)
{
var matrixA = MatrixLoader.GenerateRandomMatrix(row, column);
var factorSvd = matrixA.Svd(true);
// Make sure the U has the right dimensions.
Assert.AreEqual(row, factorSvd.U().RowCount);
Assert.AreEqual(row, factorSvd.U().ColumnCount);
// Make sure the VT has the right dimensions.
Assert.AreEqual(column, factorSvd.VT().RowCount);
Assert.AreEqual(column, factorSvd.VT().ColumnCount);
// Make sure the W has the right dimensions.
Assert.AreEqual(row, factorSvd.W().RowCount);
Assert.AreEqual(column, factorSvd.W().ColumnCount);
// Make sure the U*W*VT is the original matrix.
var matrix = factorSvd.U() * factorSvd.W() * factorSvd.VT();
for (var i = 0; i < matrix.RowCount; i++)
{
for (var j = 0; j < matrix.ColumnCount; j++)
{
Assert.AreApproximatelyEqual(matrixA[i, j], matrix[i, j], 1.0e-11);
}
}
}
[Test]
[Row(10, 8)]
[Row(48, 52)]
[Row(100, 93)]
[MultipleAsserts]
public void CheckRankOfNonSquare(int row, int column)
{
var matrixA = MatrixLoader.GenerateRandomMatrix(row, column);
var factorSvd = matrixA.Svd(true);
var mn = Math.Min(row, column);
Assert.AreEqual(factorSvd.Rank, mn);
}
[Test]
[Row(1)]
[Row(2)]
[Row(5)]
[Row(9)]
[Row(50)]
[Row(90)]
[MultipleAsserts]
public void CheckRankSquare(int order)
{
var matrixA = MatrixLoader.GenerateRandomMatrix(order, order);
var factorSvd = matrixA.Svd(true);
if (factorSvd.Determinant != 0)
{
Assert.AreEqual(factorSvd.Rank, order);
}
else
{
Assert.AreEqual(factorSvd.Rank, order - 1);
}
}
[Test]
[Row(10)]
[Row(50)]
[Row(100)]
[MultipleAsserts]
public void CheckRankOfSquareSingular(int order)
{
var matrixA = new DenseMatrix(order, order);
matrixA[0, 0] = 1;
matrixA[order - 1, order - 1] = 1;
for (var i = 1; i < order - 1; i++)
{
matrixA[i, i - 1] = 1;
matrixA[i, i + 1] = 1;
matrixA[i - 1, i] = 1;
matrixA[i + 1, i] = 1;
}
var factorSvd = matrixA.Svd(true);
Assert.AreEqual(factorSvd.Determinant, 0);
Assert.AreEqual(factorSvd.Rank, order - 1);
}
[Test]
[ExpectedException(typeof(InvalidOperationException))]
public void CannotSolveMatrixIfVectorsNotComputed()
{
var matrixA = MatrixLoader.GenerateRandomMatrix(10, 10);
var factorSvd = matrixA.Svd(false);
var matrixB = MatrixLoader.GenerateRandomMatrix(10, 10);
factorSvd.Solve(matrixB);
}
[Test]
[ExpectedException(typeof(InvalidOperationException))]
public void CannotSolveVectorIfVectorsNotComputed()
{
var matrixA = MatrixLoader.GenerateRandomMatrix(10, 10);
var factorSvd = matrixA.Svd(false);
var vectorb = MatrixLoader.GenerateRandomVector(10);
factorSvd.Solve(vectorb);
}
[Test]
[Row(1, 1)]
[Row(2, 2)]
[Row(5, 5)]
[Row(9, 10)]
[Row(50, 50)]
[Row(90, 100)]
[MultipleAsserts]
public void CanSolveForRandomVector(int row, int column)
{
var matrixA = MatrixLoader.GenerateRandomMatrix(row, column);
var matrixACopy = matrixA.Clone();
var factorSvd = matrixA.Svd(true);
var vectorb = MatrixLoader.GenerateRandomVector(row);
var resultx = factorSvd.Solve(vectorb);
Assert.AreEqual(matrixA.ColumnCount, resultx.Count);
var bReconstruct = matrixA * resultx;
// Check the reconstruction.
for (var i = 0; i < vectorb.Count; i++)
{
Assert.AreApproximatelyEqual(vectorb[i], bReconstruct[i], 1.0e-11);
}
// Make sure A didn't change.
for (var i = 0; i < matrixA.RowCount; i++)
{
for (var j = 0; j < matrixA.ColumnCount; j++)
{
Assert.AreEqual(matrixACopy[i, j], matrixA[i, j]);
}
}
}
[Test]
[Row(1, 1)]
[Row(4, 4)]
[Row(7, 8)]
[Row(10, 10)]
[Row(45, 50)]
[Row(80, 100)]
[MultipleAsserts]
public void CanSolveForRandomMatrix(int row, int count)
{
var matrixA = MatrixLoader.GenerateRandomMatrix(row, count);
var matrixACopy = matrixA.Clone();
var factorSvd = matrixA.Svd(true);
var matrixB = MatrixLoader.GenerateRandomMatrix(row, count);
var matrixX = factorSvd.Solve(matrixB);
// The solution X row dimension is equal to the column dimension of A
Assert.AreEqual(matrixA.ColumnCount, matrixX.RowCount);
// The solution X has the same number of columns as B
Assert.AreEqual(matrixB.ColumnCount, matrixX.ColumnCount);
var matrixBReconstruct = matrixA * matrixX;
// Check the reconstruction.
for (var i = 0; i < matrixB.RowCount; i++)
{
for (var j = 0; j < matrixB.ColumnCount; j++)
{
Assert.AreApproximatelyEqual(matrixB[i, j], matrixBReconstruct[i, j], 1.0e-11);
}
}
// Make sure A didn't change.
for (var i = 0; i < matrixA.RowCount; i++)
{
for (var j = 0; j < matrixA.ColumnCount; j++)
{
Assert.AreEqual(matrixACopy[i, j], matrixA[i, j]);
}
}
}
[Test]
[Row(1, 1)]
[Row(2, 2)]
[Row(5, 5)]
[Row(9, 10)]
[Row(50, 50)]
[Row(90, 100)]
[MultipleAsserts]
public void CanSolveForRandomVectorWhenResultVectorGiven(int row, int column)
{
var matrixA = MatrixLoader.GenerateRandomMatrix(row, column);
var matrixACopy = matrixA.Clone();
var factorSvd = matrixA.Svd(true);
var vectorb = MatrixLoader.GenerateRandomVector(row);
var vectorbCopy = vectorb.Clone();
var resultx = new DenseVector(column);
factorSvd.Solve(vectorb,resultx);
var bReconstruct = matrixA * resultx;
// Check the reconstruction.
for (var i = 0; i < vectorb.Count; i++)
{
Assert.AreApproximatelyEqual(vectorb[i], bReconstruct[i], 1.0e-11);
}
// Make sure A didn't change.
for (var i = 0; i < matrixA.RowCount; i++)
{
for (var j = 0; j < matrixA.ColumnCount; j++)
{
Assert.AreEqual(matrixACopy[i, j], matrixA[i, j]);
}
}
// Make sure b didn't change.
for (var i = 0; i < vectorb.Count; i++)
{
Assert.AreEqual(vectorbCopy[i], vectorb[i]);
}
}
[Test]
[Row(1, 1)]
[Row(4, 4)]
[Row(7, 8)]
[Row(10, 10)]
[Row(45, 50)]
[Row(80, 100)]
[MultipleAsserts]
public void CanSolveForRandomMatrixWhenResultMatrixGiven(int row, int column)
{
var matrixA = MatrixLoader.GenerateRandomMatrix(row, column);
var matrixACopy = matrixA.Clone();
var factorSvd = matrixA.Svd(true);
var matrixB = MatrixLoader.GenerateRandomMatrix(row, column);
var matrixBCopy = matrixB.Clone();
var matrixX = new DenseMatrix(column, column);
factorSvd.Solve(matrixB,matrixX);
// The solution X row dimension is equal to the column dimension of A
Assert.AreEqual(matrixA.ColumnCount, matrixX.RowCount);
// The solution X has the same number of columns as B
Assert.AreEqual(matrixB.ColumnCount, matrixX.ColumnCount);
var matrixBReconstruct = matrixA * matrixX;
// Check the reconstruction.
for (var i = 0; i < matrixB.RowCount; i++)
{
for (var j = 0; j < matrixB.ColumnCount; j++)
{
Assert.AreApproximatelyEqual(matrixB[i, j], matrixBReconstruct[i, j], 1.0e-11);
}
}
// Make sure A didn't change.
for (var i = 0; i < matrixA.RowCount; i++)
{
for (var j = 0; j < matrixA.ColumnCount; j++)
{
Assert.AreEqual(matrixACopy[i, j], matrixA[i, j]);
}
}
// Make sure B didn't change.
for (var i = 0; i < matrixB.RowCount; i++)
{
for (var j = 0; j < matrixB.ColumnCount; j++)
{
Assert.AreEqual(matrixBCopy[i, j], matrixB[i, j]);
}
}
}
}
}

1
src/UnitTests/UnitTests.csproj

@ -90,6 +90,7 @@
<Compile Include="ComplexTests\ComplexTest.cs" />
<Compile Include="ComplexTests\Complex32Test.TextHandling.cs" />
<Compile Include="ComplexTests\Complex32Test.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\SvdTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\QRTests.cs" />
<Compile Include="LinearAlgebraTests\Double\SparseMatrixTests.cs" />
<Compile Include="PermutationTest.cs" />

Loading…
Cancel
Save