|
|
|
@ -24,7 +24,11 @@ |
|
|
|
|
|
|
|
/* This file is automatically generated - do not modify it. |
|
|
|
Change NativeLinearAlgebraProvider.include instead. |
|
|
|
<<<<<<< HEAD:src/Numerics/Algorithms/LinearAlgebra/Atlas/AtlasLinearAlgebraProvider.cs |
|
|
|
Last generated on: 14/11/2009 20:09:22 |
|
|
|
======= |
|
|
|
Last generated on: 11/13/2009 9:49:35 AM |
|
|
|
>>>>>>> c1c4de3... adding dot product:src/Numerics/Algorithms/LinearAlgebra/Atlas/AtlasLinearAlgebraProvider.cs |
|
|
|
*/ |
|
|
|
namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
{ |
|
|
|
@ -36,7 +40,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// </summary>
|
|
|
|
public class AtlasLinearAlgebraProvider : ILinearAlgebraProvider |
|
|
|
{ |
|
|
|
#region ILinearAlgebraProvider<double> Members
|
|
|
|
#region ILinearAlgebraProvider<double> Members
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Adds a scaled vector to another: <c>y += alpha*x</c>.
|
|
|
|
@ -78,6 +82,11 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <remarks>This is equivalent to the SCAL BLAS routine.</remarks>
|
|
|
|
public void ScaleArray(double alpha, double[] x) |
|
|
|
{ |
|
|
|
if (x == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (alpha == 1.0) |
|
|
|
{ |
|
|
|
return; |
|
|
|
@ -86,20 +95,6 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
SafeNativeMethods.d_scale(x.Length, alpha, x); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Queries the provider for the optimal, workspace block size
|
|
|
|
/// for the given routine.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="methodName">Name of the method to query.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// -1 if the provider cannot compute the workspace size; otherwise
|
|
|
|
/// the suggested block size.
|
|
|
|
/// </returns>
|
|
|
|
public int QueryWorkspaceBlockSize(string methodName) |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Computes the dot product of x and y.
|
|
|
|
/// </summary>
|
|
|
|
@ -109,7 +104,22 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <remarks>This is equivalent to the DOT BLAS routine.</remarks>
|
|
|
|
public double DotProduct(double[] x, double[] y) |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
if (y == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("y"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x.Length != y.Length) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentArraysSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
return SafeNativeMethods.d_dot_product(x.Length, x, y); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -261,8 +271,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// </summary>
|
|
|
|
/// <param name="a">The N by N matrix to invert. Contains the inverse On exit.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
|
|
|
|
/// work size value.</param>
|
|
|
|
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
|
|
|
|
public void LUInverse(double[] a, double[] work) |
|
|
|
@ -276,8 +285,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
|
|
|
|
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
|
|
|
|
/// work size value.</param>
|
|
|
|
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
|
|
|
|
public void LUInverseFactored(double[] a, int[] ipiv, double[] work) |
|
|
|
@ -393,8 +401,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// 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) |
|
|
|
{ |
|
|
|
@ -427,8 +434,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <param name="b">The B matrix.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// 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) |
|
|
|
{ |
|
|
|
@ -572,6 +578,11 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <remarks>This is equivalent to the SCAL BLAS routine.</remarks>
|
|
|
|
public void ScaleArray(float alpha, float[] x) |
|
|
|
{ |
|
|
|
if (x == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (alpha == 1.0) |
|
|
|
{ |
|
|
|
return; |
|
|
|
@ -589,7 +600,22 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <remarks>This is equivalent to the DOT BLAS routine.</remarks>
|
|
|
|
public float DotProduct(float[] x, float[] y) |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
if (y == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("y"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x.Length != y.Length) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentArraysSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
return SafeNativeMethods.s_dot_product(x.Length, x, y); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -741,8 +767,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// </summary>
|
|
|
|
/// <param name="a">The N by N matrix to invert. Contains the inverse On exit.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
|
|
|
|
/// work size value.</param>
|
|
|
|
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
|
|
|
|
public void LUInverse(float[] a, float[] work) |
|
|
|
@ -756,8 +781,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
|
|
|
|
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
|
|
|
|
/// work size value.</param>
|
|
|
|
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
|
|
|
|
public void LUInverseFactored(float[] a, int[] ipiv, float[] work) |
|
|
|
@ -873,8 +897,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// 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) |
|
|
|
{ |
|
|
|
@ -907,8 +930,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <param name="b">The B matrix.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// 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) |
|
|
|
{ |
|
|
|
@ -1052,6 +1074,11 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <remarks>This is equivalent to the SCAL BLAS routine.</remarks>
|
|
|
|
public void ScaleArray(Complex alpha, Complex[] x) |
|
|
|
{ |
|
|
|
if (x == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (alpha.IsOne) |
|
|
|
{ |
|
|
|
return; |
|
|
|
@ -1069,7 +1096,22 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <remarks>This is equivalent to the DOT BLAS routine.</remarks>
|
|
|
|
public Complex DotProduct(Complex[] x, Complex[] y) |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
if (y == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("y"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x.Length != y.Length) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentArraysSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
return SafeNativeMethods.z_dot_product(x.Length, x, y); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1221,8 +1263,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// </summary>
|
|
|
|
/// <param name="a">The N by N matrix to invert. Contains the inverse On exit.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
|
|
|
|
/// work size value.</param>
|
|
|
|
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
|
|
|
|
public void LUInverse(Complex[] a, Complex[] work) |
|
|
|
@ -1236,8 +1277,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
|
|
|
|
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
|
|
|
|
/// work size value.</param>
|
|
|
|
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
|
|
|
|
public void LUInverseFactored(Complex[] a, int[] ipiv, Complex[] work) |
|
|
|
@ -1353,8 +1393,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// 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) |
|
|
|
{ |
|
|
|
@ -1387,8 +1426,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <param name="b">The B matrix.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// 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) |
|
|
|
{ |
|
|
|
@ -1532,6 +1570,11 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <remarks>This is equivalent to the SCAL BLAS routine.</remarks>
|
|
|
|
public void ScaleArray(Complex32 alpha, Complex32[] x) |
|
|
|
{ |
|
|
|
if (x == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (alpha.IsOne) |
|
|
|
{ |
|
|
|
return; |
|
|
|
@ -1549,7 +1592,22 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <remarks>This is equivalent to the DOT BLAS routine.</remarks>
|
|
|
|
public Complex32 DotProduct(Complex32[] x, Complex32[] y) |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
if (y == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("y"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x.Length != y.Length) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentArraysSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
return SafeNativeMethods.c_dot_product(x.Length, x, y); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1701,8 +1759,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// </summary>
|
|
|
|
/// <param name="a">The N by N matrix to invert. Contains the inverse On exit.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
|
|
|
|
/// work size value.</param>
|
|
|
|
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
|
|
|
|
public void LUInverse(Complex32[] a, Complex32[] work) |
|
|
|
@ -1716,8 +1773,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
|
|
|
|
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
|
|
|
|
/// work size value.</param>
|
|
|
|
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
|
|
|
|
public void LUInverseFactored(Complex32[] a, int[] ipiv, Complex32[] work) |
|
|
|
@ -1833,8 +1889,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// 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) |
|
|
|
{ |
|
|
|
@ -1867,8 +1922,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas |
|
|
|
/// <param name="b">The B matrix.</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. Use <see cref="QueryWorkspaceBlockSize"/>
|
|
|
|
/// to determine the optimal size of the work array. On exit, work[0] contains the optimal
|
|
|
|
/// 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) |
|
|
|
{ |
|
|
|
|