diff --git a/src/Numerics/Algorithms/LinearAlgebra/Atlas/AtlasLinearAlgebraProvider.cs b/src/Numerics/Algorithms/LinearAlgebra/Atlas/AtlasLinearAlgebraProvider.cs index 79356294..43597ca2 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/Atlas/AtlasLinearAlgebraProvider.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/Atlas/AtlasLinearAlgebraProvider.cs @@ -23,8 +23,8 @@ // /* This file is automatically generated - do not modify it. - Change NativeLinearAlgebraProvider instead. - Last generated on: 10/30/2009 3:38:53 PM + Change NativeLinearAlgebraProvider.include instead. + Last generated on: 11/4/2009 2:23:32 PM */ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas { @@ -243,7 +243,27 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas public void AddVectorToScaledVector(float[] y, float alpha, float[] x) { - throw new NotImplementedException(); + if (y == null) + { + throw new ArgumentNullException("y"); + } + + if (x == null) + { + throw new ArgumentNullException("x"); + } + + if (y.Length != x.Length) + { + throw new ArgumentException(Resources.ArgumentVectorsSameLength); + } + + if (alpha == 0.0f) + { + return; + } + + SafeNativeMethods.s_axpy(y.Length, alpha, x, y); } public void ScaleArray(float alpha, float[] x) @@ -408,7 +428,27 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas public void AddVectorToScaledVector(Complex[] y, Complex alpha, Complex[] x) { - throw new NotImplementedException(); + if (y == null) + { + throw new ArgumentNullException("y"); + } + + if (x == null) + { + throw new ArgumentNullException("x"); + } + + if (y.Length != x.Length) + { + throw new ArgumentException(Resources.ArgumentVectorsSameLength); + } + + if (alpha.IsZero) + { + return; + } + + SafeNativeMethods.z_axpy(y.Length, ref alpha, x, y); } public void ScaleArray(Complex alpha, Complex[] x) @@ -567,5 +607,189 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas } #endregion + + #region ILinearAlgebraProvider Members + + public void AddVectorToScaledVector(Complex32[] y, Complex32 alpha, Complex32[] x) + { + if (y == null) + { + throw new ArgumentNullException("y"); + } + + if (x == null) + { + throw new ArgumentNullException("x"); + } + + if (y.Length != x.Length) + { + throw new ArgumentException(Resources.ArgumentVectorsSameLength); + } + + if (alpha.IsZero) + { + return; + } + + SafeNativeMethods.c_axpy(y.Length, ref alpha, x, y); + } + + public void ScaleArray(Complex32 alpha, Complex32[] x) + { + throw new NotImplementedException(); + } + + public Complex32 DotProduct(Complex32[] x, Complex32[] y) + { + throw new NotImplementedException(); + } + + public void AddArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void SubtractArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void PointWiseMultiplyArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public Complex32 MatrixNorm(Norm norm, Complex32[] matrix) + { + throw new NotImplementedException(); + } + + public Complex32 MatrixNorm(Norm norm, Complex32[] matrix, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void MatrixMultiply(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, Complex32 alpha, Complex32[] a, Complex32[] b, Complex32 beta, Complex32[] c) + { + throw new NotImplementedException(); + } + + public void LUFactor(Complex32[] a, int[] ipiv) + { + throw new NotImplementedException(); + } + + public void LUInverse(Complex32[] a) + { + throw new NotImplementedException(); + } + + public void LUInverseFactored(Complex32[] a, int[] ipiv) + { + throw new NotImplementedException(); + } + + public void LUInverse(Complex32[] a, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void LUInverseFactored(Complex32[] a, int[] ipiv, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void LUSolve(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolveFactored(int columnsOfB, Complex32[] a, int ipiv, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolve(Transpose transposeA, int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolveFactored(Transpose transposeA, int columnsOfB, Complex32[] a, int ipiv, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void CholeskyFactor(Complex32[] a) + { + throw new NotImplementedException(); + } + + public void CholeskySolve(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void CholeskySolveFactored(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void QRFactor(Complex32[] r, Complex32[] q) + { + throw new NotImplementedException(); + } + + public void QRFactor(Complex32[] r, Complex32[] q, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void QRSolveFactored(int columnsOfB, Complex32[] q, Complex32[] r, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void SinguarValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt) + { + throw new NotImplementedException(); + } + + public void SingularValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void SvdSolveFactored(int columnsOfB, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + #endregion } } \ No newline at end of file diff --git a/src/Numerics/Algorithms/LinearAlgebra/Atlas/SafeNativeMethods.cs b/src/Numerics/Algorithms/LinearAlgebra/Atlas/SafeNativeMethods.cs index c7915608..03b74b7e 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/Atlas/SafeNativeMethods.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/Atlas/SafeNativeMethods.cs @@ -26,6 +26,11 @@ // OTHER DEALINGS IN THE SOFTWARE. // +/* This file is automatically generated - do not modify it. + Change SafeNativeMethods.include instead. + Last generated on: 11/4/2009 2:23:36 PM +*/ + using System.Runtime.InteropServices; using System.Security; @@ -44,8 +49,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] internal static extern void d_axpy(int n, double alpha, double[] x, [In, Out] double[] y); - //[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] - //internal static extern void c_axpy(int n, ref Complex32 alpha, Complex32[] x, [In, Out] Complex32[] y); + [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] + internal static extern void c_axpy(int n, ref Complex32 alpha, Complex32[] x, [In, Out] Complex32[] y); [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] internal static extern void z_axpy(int n, ref Complex alpha, Complex[] x, [In, Out] Complex[] y); diff --git a/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs b/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs index 640c74fb..e0a4a0be 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/ILinearAlgebraProvider.cs @@ -28,7 +28,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra /// /// Interface to linear algebra algorithms that work off 1-D arrays. /// - public interface ILinearAlgebraProvider : ILinearAlgebraProvider, ILinearAlgebraProvider, ILinearAlgebraProvider//, ILinearAlgebraProvider + public interface ILinearAlgebraProvider : ILinearAlgebraProvider, ILinearAlgebraProvider, ILinearAlgebraProvider, ILinearAlgebraProvider { } } diff --git a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs index dca2089c..39dca482 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs @@ -575,5 +575,170 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra } #endregion + + #region ILinearAlgebraProvider Members + + + public void AddVectorToScaledVector(Complex32[] y, Complex32 alpha, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void ScaleArray(Complex32 alpha, Complex32[] x) + { + throw new NotImplementedException(); + } + + public Complex32 DotProduct(Complex32[] x, Complex32[] y) + { + throw new NotImplementedException(); + } + + public void AddArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void SubtractArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void PointWiseMultiplyArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public Complex32 MatrixNorm(Norm norm, Complex32[] matrix) + { + throw new NotImplementedException(); + } + + public Complex32 MatrixNorm(Norm norm, Complex32[] matrix, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void MatrixMultiply(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, Complex32 alpha, Complex32[] a, Complex32[] b, Complex32 beta, Complex32[] c) + { + throw new NotImplementedException(); + } + + public void LUFactor(Complex32[] a, int[] ipiv) + { + throw new NotImplementedException(); + } + + public void LUInverse(Complex32[] a) + { + throw new NotImplementedException(); + } + + public void LUInverseFactored(Complex32[] a, int[] ipiv) + { + throw new NotImplementedException(); + } + + public void LUInverse(Complex32[] a, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void LUInverseFactored(Complex32[] a, int[] ipiv, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void LUSolve(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolveFactored(int columnsOfB, Complex32[] a, int ipiv, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolve(Transpose transposeA, int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolveFactored(Transpose transposeA, int columnsOfB, Complex32[] a, int ipiv, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void CholeskyFactor(Complex32[] a) + { + throw new NotImplementedException(); + } + + public void CholeskySolve(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void CholeskySolveFactored(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void QRFactor(Complex32[] r, Complex32[] q) + { + throw new NotImplementedException(); + } + + public void QRFactor(Complex32[] r, Complex32[] q, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void QRSolveFactored(int columnsOfB, Complex32[] q, Complex32[] r, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void SinguarValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt) + { + throw new NotImplementedException(); + } + + public void SingularValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void SvdSolveFactored(int columnsOfB, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + #endregion } } \ No newline at end of file diff --git a/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs b/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs index fad34bec..eabbc808 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs @@ -21,6 +21,11 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // + +/* This file is automatically generated - do not modify it. + Change NativeLinearAlgebraProvider.include instead. + Last generated on: 11/4/2009 2:23:28 PM +*/ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl { using System; @@ -238,7 +243,27 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl public void AddVectorToScaledVector(float[] y, float alpha, float[] x) { - throw new NotImplementedException(); + if (y == null) + { + throw new ArgumentNullException("y"); + } + + if (x == null) + { + throw new ArgumentNullException("x"); + } + + if (y.Length != x.Length) + { + throw new ArgumentException(Resources.ArgumentVectorsSameLength); + } + + if (alpha == 0.0f) + { + return; + } + + SafeNativeMethods.s_axpy(y.Length, alpha, x, y); } public void ScaleArray(float alpha, float[] x) @@ -403,7 +428,27 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl public void AddVectorToScaledVector(Complex[] y, Complex alpha, Complex[] x) { - throw new NotImplementedException(); + if (y == null) + { + throw new ArgumentNullException("y"); + } + + if (x == null) + { + throw new ArgumentNullException("x"); + } + + if (y.Length != x.Length) + { + throw new ArgumentException(Resources.ArgumentVectorsSameLength); + } + + if (alpha.IsZero) + { + return; + } + + SafeNativeMethods.z_axpy(y.Length, ref alpha, x, y); } public void ScaleArray(Complex alpha, Complex[] x) @@ -562,5 +607,189 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl } #endregion + + #region ILinearAlgebraProvider Members + + public void AddVectorToScaledVector(Complex32[] y, Complex32 alpha, Complex32[] x) + { + if (y == null) + { + throw new ArgumentNullException("y"); + } + + if (x == null) + { + throw new ArgumentNullException("x"); + } + + if (y.Length != x.Length) + { + throw new ArgumentException(Resources.ArgumentVectorsSameLength); + } + + if (alpha.IsZero) + { + return; + } + + SafeNativeMethods.c_axpy(y.Length, ref alpha, x, y); + } + + public void ScaleArray(Complex32 alpha, Complex32[] x) + { + throw new NotImplementedException(); + } + + public Complex32 DotProduct(Complex32[] x, Complex32[] y) + { + throw new NotImplementedException(); + } + + public void AddArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void SubtractArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void PointWiseMultiplyArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public Complex32 MatrixNorm(Norm norm, Complex32[] matrix) + { + throw new NotImplementedException(); + } + + public Complex32 MatrixNorm(Norm norm, Complex32[] matrix, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void MatrixMultiply(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, Complex32 alpha, Complex32[] a, Complex32[] b, Complex32 beta, Complex32[] c) + { + throw new NotImplementedException(); + } + + public void LUFactor(Complex32[] a, int[] ipiv) + { + throw new NotImplementedException(); + } + + public void LUInverse(Complex32[] a) + { + throw new NotImplementedException(); + } + + public void LUInverseFactored(Complex32[] a, int[] ipiv) + { + throw new NotImplementedException(); + } + + public void LUInverse(Complex32[] a, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void LUInverseFactored(Complex32[] a, int[] ipiv, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void LUSolve(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolveFactored(int columnsOfB, Complex32[] a, int ipiv, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolve(Transpose transposeA, int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolveFactored(Transpose transposeA, int columnsOfB, Complex32[] a, int ipiv, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void CholeskyFactor(Complex32[] a) + { + throw new NotImplementedException(); + } + + public void CholeskySolve(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void CholeskySolveFactored(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void QRFactor(Complex32[] r, Complex32[] q) + { + throw new NotImplementedException(); + } + + public void QRFactor(Complex32[] r, Complex32[] q, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void QRSolveFactored(int columnsOfB, Complex32[] q, Complex32[] r, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void SinguarValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt) + { + throw new NotImplementedException(); + } + + public void SingularValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void SvdSolveFactored(int columnsOfB, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + #endregion } } \ No newline at end of file diff --git a/src/Numerics/Algorithms/LinearAlgebra/Mkl/SafeNativeMethods.cs b/src/Numerics/Algorithms/LinearAlgebra/Mkl/SafeNativeMethods.cs index 1d5277a9..e85222b5 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/Mkl/SafeNativeMethods.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/Mkl/SafeNativeMethods.cs @@ -28,7 +28,7 @@ /* This file is automatically generated - do not modify it. Change SafeNativeMethods.include instead. - Last generated on: 10/30/2009 3:39:44 PM + Last generated on: 11/4/2009 2:23:40 PM */ using System.Runtime.InteropServices; @@ -49,8 +49,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] internal static extern void d_axpy(int n, double alpha, double[] x, [In, Out] double[] y); - //[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] - //internal static extern void c_axpy(int n, ref Complex32 alpha, Complex32[] x, [In, Out] Complex32[] y); + [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] + internal static extern void c_axpy(int n, ref Complex32 alpha, Complex32[] x, [In, Out] Complex32[] y); [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] internal static extern void z_axpy(int n, ref Complex alpha, Complex[] x, [In, Out] Complex[] y); diff --git a/src/Numerics/Algorithms/LinearAlgebra/NativeAlgebraProvider.include b/src/Numerics/Algorithms/LinearAlgebra/NativeAlgebraProvider.include index 063ed9ad..d21df3bb 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/NativeAlgebraProvider.include +++ b/src/Numerics/Algorithms/LinearAlgebra/NativeAlgebraProvider.include @@ -243,7 +243,27 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#> public void AddVectorToScaledVector(float[] y, float alpha, float[] x) { - throw new NotImplementedException(); + if (y == null) + { + throw new ArgumentNullException("y"); + } + + if (x == null) + { + throw new ArgumentNullException("x"); + } + + if (y.Length != x.Length) + { + throw new ArgumentException(Resources.ArgumentVectorsSameLength); + } + + if (alpha == 0.0f) + { + return; + } + + SafeNativeMethods.s_axpy(y.Length, alpha, x, y); } public void ScaleArray(float alpha, float[] x) @@ -408,7 +428,27 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#> public void AddVectorToScaledVector(Complex[] y, Complex alpha, Complex[] x) { - throw new NotImplementedException(); + if (y == null) + { + throw new ArgumentNullException("y"); + } + + if (x == null) + { + throw new ArgumentNullException("x"); + } + + if (y.Length != x.Length) + { + throw new ArgumentException(Resources.ArgumentVectorsSameLength); + } + + if (alpha.IsZero) + { + return; + } + + SafeNativeMethods.z_axpy(y.Length, ref alpha, x, y); } public void ScaleArray(Complex alpha, Complex[] x) @@ -567,5 +607,189 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#> } #endregion + + #region ILinearAlgebraProvider Members + + public void AddVectorToScaledVector(Complex32[] y, Complex32 alpha, Complex32[] x) + { + if (y == null) + { + throw new ArgumentNullException("y"); + } + + if (x == null) + { + throw new ArgumentNullException("x"); + } + + if (y.Length != x.Length) + { + throw new ArgumentException(Resources.ArgumentVectorsSameLength); + } + + if (alpha.IsZero) + { + return; + } + + SafeNativeMethods.c_axpy(y.Length, ref alpha, x, y); + } + + public void ScaleArray(Complex32 alpha, Complex32[] x) + { + throw new NotImplementedException(); + } + + public Complex32 DotProduct(Complex32[] x, Complex32[] y) + { + throw new NotImplementedException(); + } + + public void AddArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void SubtractArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void PointWiseMultiplyArrays(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public Complex32 MatrixNorm(Norm norm, Complex32[] matrix) + { + throw new NotImplementedException(); + } + + public Complex32 MatrixNorm(Norm norm, Complex32[] matrix, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void MatrixMultiply(Complex32[] x, Complex32[] y, Complex32[] result) + { + throw new NotImplementedException(); + } + + public void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, Complex32 alpha, Complex32[] a, Complex32[] b, Complex32 beta, Complex32[] c) + { + throw new NotImplementedException(); + } + + public void LUFactor(Complex32[] a, int[] ipiv) + { + throw new NotImplementedException(); + } + + public void LUInverse(Complex32[] a) + { + throw new NotImplementedException(); + } + + public void LUInverseFactored(Complex32[] a, int[] ipiv) + { + throw new NotImplementedException(); + } + + public void LUInverse(Complex32[] a, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void LUInverseFactored(Complex32[] a, int[] ipiv, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void LUSolve(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolveFactored(int columnsOfB, Complex32[] a, int ipiv, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolve(Transpose transposeA, int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void LUSolveFactored(Transpose transposeA, int columnsOfB, Complex32[] a, int ipiv, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void CholeskyFactor(Complex32[] a) + { + throw new NotImplementedException(); + } + + public void CholeskySolve(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void CholeskySolveFactored(int columnsOfB, Complex32[] a, Complex32[] b) + { + throw new NotImplementedException(); + } + + public void QRFactor(Complex32[] r, Complex32[] q) + { + throw new NotImplementedException(); + } + + public void QRFactor(Complex32[] r, Complex32[] q, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void QRSolve(int columnsOfB, Complex32[] r, Complex32[] q, Complex32[] b, Complex32[] x, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void QRSolveFactored(int columnsOfB, Complex32[] q, Complex32[] r, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void SinguarValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt) + { + throw new NotImplementedException(); + } + + public void SingularValueDecomposition(bool computeVectors, Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + public void SvdSolve(Complex32[] a, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x, Complex32[] work) + { + throw new NotImplementedException(); + } + + public void SvdSolveFactored(int columnsOfB, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, Complex32[] x) + { + throw new NotImplementedException(); + } + + #endregion } } \ No newline at end of file diff --git a/src/Numerics/Algorithms/LinearAlgebra/SafeNativeMethods.include b/src/Numerics/Algorithms/LinearAlgebra/SafeNativeMethods.include index 4dd6e103..a0db37df 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/SafeNativeMethods.include +++ b/src/Numerics/Algorithms/LinearAlgebra/SafeNativeMethods.include @@ -49,8 +49,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#= namespaceSuffix #> [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] internal static extern void d_axpy(int n, double alpha, double[] x, [In, Out] double[] y); - //[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] - //internal static extern void c_axpy(int n, ref Complex32 alpha, Complex32[] x, [In, Out] Complex32[] y); + [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] + internal static extern void c_axpy(int n, ref Complex32 alpha, Complex32[] x, [In, Out] Complex32[] y); [DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] internal static extern void z_axpy(int n, ref Complex alpha, Complex[] x, [In, Out] Complex[] y); diff --git a/src/Numerics/Numerics.csproj b/src/Numerics/Numerics.csproj index d9810795..32bb814a 100644 --- a/src/Numerics/Numerics.csproj +++ b/src/Numerics/Numerics.csproj @@ -45,9 +45,9 @@ - AtlasLinearAlgebraProvider.tt True True + AtlasLinearAlgebraProvider.tt SafeNativeMethods.tt @@ -59,9 +59,9 @@ - MklLinearAlgebraProvider.tt True True + MklLinearAlgebraProvider.tt True