Browse Source

native: native providers now extend mananaged provider

split native providers it type based templates
la-knuth
Marcus Cuda 16 years ago
parent
commit
71ccf00c9b
  1. 2592
      src/Numerics/Algorithms/LinearAlgebra/Atlas/AtlasLinearAlgebraProvider.cs
  2. 4
      src/Numerics/Algorithms/LinearAlgebra/Atlas/AtlasLinearAlgebraProvider.tt
  3. 121
      src/Numerics/Algorithms/LinearAlgebra/Atlas/SafeNativeMethods.cs
  4. 9
      src/Numerics/Algorithms/LinearAlgebra/Atlas/SafeNativeMethods.tt
  5. 66
      src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs
  6. 66
      src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs
  7. 66
      src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Double.cs
  8. 66
      src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Single.cs
  9. 10
      src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex.tt
  10. 10
      src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex32.tt
  11. 2591
      src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs
  12. 10
      src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.double.tt
  13. 10
      src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.float.tt
  14. 4
      src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.tt
  15. 160
      src/Numerics/Algorithms/LinearAlgebra/Mkl/SafeNativeMethods.cs
  16. 2080
      src/Numerics/Algorithms/LinearAlgebra/NativeAlgebraProvider.include
  17. 45
      src/Numerics/Numerics.csproj

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

File diff suppressed because it is too large

4
src/Numerics/Algorithms/LinearAlgebra/Atlas/AtlasLinearAlgebraProvider.tt

@ -1,4 +0,0 @@
<#@ template language="C#" debug="true" #>
<#@ output extenstion="cs" #>
<# string library = "Atlas";#>
<#@ include file="..\NativeAlgebraProvider.include" #>

121
src/Numerics/Algorithms/LinearAlgebra/Atlas/SafeNativeMethods.cs

@ -1,121 +0,0 @@
// <copyright file="SafeNativeMethods.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://mathnet.opensourcedotnet.info
//
// Copyright (c) 2009 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>
/* This file is automatically generated - do not modify it.
Change SafeNativeMethods.include instead.
Last generated on UTC 2010-06-27 13:08:33Z
*/
using System.Numerics;
using System.Runtime.InteropServices;
using System.Security;
namespace MathNet.Numerics.Algorithms.LinearAlgebra.Atlas
{
/// <summary>
/// P/Invoke methods to the native math libraries.
/// </summary>
[SuppressUnmanagedCodeSecurity]
internal static class SafeNativeMethods
{
/// <summary>
/// Name of the native DLL.
/// </summary>
private const string DllName = "MathNET.Numerics.ATLAS.dll";
#region BLAS
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void s_axpy(int n, float alpha, float[] x, [In, Out] float[] y);
[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 z_axpy(int n, ref Complex alpha, Complex[] x, [In, Out] Complex[] y);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void s_scale(int n, float alpha, [Out] float[] x);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void d_scale(int n, double alpha, [Out] double[] x);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void c_scale(int n, ref Complex32 alpha, [In, Out] Complex32[] x);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void z_scale(int n, ref Complex alpha, [In, Out] Complex[] x);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern float s_dot_product(int n, float[] x, float[] y);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern double d_dot_product(int n, double[] x, double[] y);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern Complex32 c_dot_product(int n, Complex32[] x, Complex32[] y);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern Complex z_dot_product(int n, Complex[] x, Complex[] y);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void s_matrix_multiply(Transpose transA, Transpose transB, int m, int n, int k, float alpha, float[] x, float[] y, float beta, [In, Out]float[] c);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void d_matrix_multiply(Transpose transA, Transpose transB, int m, int n, int k, double alpha, double[] x, double[] y, double beta, [In, Out]double[] c);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void c_matrix_multiply(Transpose transA, Transpose transB, int m, int n, int k, ref Complex32 alpha, Complex32[] x, Complex32[] y, ref Complex32 beta, [In, Out]Complex32[] c);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void z_matrix_multiply(Transpose transA, Transpose transB, int m, int n, int k, ref Complex alpha, Complex[] x, Complex[] y, ref Complex beta, [In, Out]Complex[] c);
#endregion BLAS
#region LAPACK
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void s_cholesky_factor(int n, [In, Out] float[] a);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void d_cholesky_factor(int n, [In, Out] double[] a);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void c_cholesky_factor(int n, [In, Out] Complex32[] a);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void z_cholesky_factor(int n, [In, Out] Complex[] a);
#endregion LAPACK
}
}

9
src/Numerics/Algorithms/LinearAlgebra/Atlas/SafeNativeMethods.tt

@ -1,9 +0,0 @@
<#@ template language="C#" debug="true" #>
<#@ output extenstion="cs" #>
<# string namespaceSuffix = "Atlas";
string library = "ATLAS";
#>
<#@ include file="..\SafeNativeMethods.include" #>
}
}

66
src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs

@ -42,7 +42,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="alpha">The value to scale <paramref name="x"/> by.</param>
/// <param name="x">The vector to add to <paramref name="y"/>.</param>
/// <remarks>This equivalent to the AXPY BLAS routine.</remarks>
public void AddVectorToScaledVector(Complex[] y, Complex alpha, Complex[] x)
public virtual void AddVectorToScaledVector(Complex[] y, Complex alpha, Complex[] x)
{
if (y == null)
{
@ -80,7 +80,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="alpha">The scalar.</param>
/// <param name="x">The values to scale.</param>
/// <remarks>This is equivalent to the SCAL BLAS routine.</remarks>
public void ScaleArray(Complex alpha, Complex[] x)
public virtual void ScaleArray(Complex alpha, Complex[] x)
{
if (x == null)
{
@ -102,7 +102,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="y">The vector y.</param>
/// <returns>The dot product of x and y.</returns>
/// <remarks>This is equivalent to the DOT BLAS routine.</remarks>
public Complex DotProduct(Complex[] x, Complex[] y)
public virtual Complex DotProduct(Complex[] x, Complex[] y)
{
if (y == null)
{
@ -132,7 +132,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void AddArrays(Complex[] x, Complex[] y, Complex[] result)
public virtual void AddArrays(Complex[] x, Complex[] y, Complex[] result)
{
if (y == null)
{
@ -167,7 +167,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void SubtractArrays(Complex[] x, Complex[] y, Complex[] result)
public virtual void SubtractArrays(Complex[] x, Complex[] y, Complex[] result)
{
if (y == null)
{
@ -202,7 +202,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void PointWiseMultiplyArrays(Complex[] x, Complex[] y, Complex[] result)
public virtual void PointWiseMultiplyArrays(Complex[] x, Complex[] y, Complex[] result)
{
if (y == null)
{
@ -237,7 +237,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void PointWiseDivideArrays(Complex[] x, Complex[] y, Complex[] result)
public virtual void PointWiseDivideArrays(Complex[] x, Complex[] y, Complex[] result)
{
if (y == null)
{
@ -272,7 +272,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
/// </returns>
public Complex MatrixNorm(Norm norm, int rows, int columns, Complex[] matrix)
public virtual Complex MatrixNorm(Norm norm, int rows, int columns, Complex[] matrix)
{
var ret = 0.0;
switch (norm)
@ -342,7 +342,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
/// </returns>
public Complex MatrixNorm(Norm norm, int rows, int columns, Complex[] matrix, Complex[] work)
public virtual Complex MatrixNorm(Norm norm, int rows, int columns, Complex[] matrix, Complex[] work)
{
return MatrixNorm(norm, rows, columns, matrix);
}
@ -359,7 +359,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="result">Where to store the result of the multiplication.</param>
/// <remarks>This is a simplified version of the BLAS GEMM routine with alpha
/// set to 1.0 and beta set to 0.0, and x and y are not transposed.</remarks>
public void MatrixMultiply(Complex[] x, int rowsX, int columnsX, Complex[] y, int rowsY, int columnsY, Complex[] result)
public virtual void MatrixMultiply(Complex[] x, int rowsX, int columnsX, Complex[] y, int rowsY, int columnsY, Complex[] result)
{
// First check some basic requirement on the parameters of the matrix multiplication.
if (x == null)
@ -441,7 +441,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="columnsB">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>
public void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, Complex alpha, Complex[] a, int rowsA, int columnsA, Complex[] b, int rowsB, int columnsB, Complex beta, Complex[] c)
public virtual void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, Complex alpha, Complex[] a, int rowsA, int columnsA, Complex[] b, int rowsB, int columnsB, Complex beta, Complex[] c)
{
// Choose nonsensical values for the number of rows in c; fill them in depending
// on the operations on a and b.
@ -819,7 +819,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="data"/>.</param>
/// <param name="ipiv">On exit, it contains the pivot indices. The size of the array must be <paramref name="order"/>.</param>
/// <remarks>This is equivalent to the GETRF LAPACK routine.</remarks>
public void LUFactor(Complex[] data, int order, int[] ipiv)
public virtual void LUFactor(Complex[] data, int order, int[] ipiv)
{
if (data == null)
{
@ -917,7 +917,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="a">The N by N matrix to invert. Contains the inverse On exit.</param>
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
public void LUInverse(Complex[] a, int order)
public virtual void LUInverse(Complex[] a, int order)
{
if (a == null)
{
@ -941,7 +941,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
public void LUInverseFactored(Complex[] a, int order, int[] ipiv)
public virtual void LUInverseFactored(Complex[] a, int order, int[] ipiv)
{
if (a == null)
{
@ -982,7 +982,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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, int order, Complex[] work)
public virtual void LUInverse(Complex[] a, int order, Complex[] work)
{
LUInverse(a, order);
}
@ -997,7 +997,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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 order, int[] ipiv, Complex[] work)
public virtual void LUInverseFactored(Complex[] a, int order, int[] ipiv, Complex[] work)
{
LUInverseFactored(a, order, ipiv);
}
@ -1010,7 +1010,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRF and GETRS LAPACK routines.</remarks>
public void LUSolve(int columnsOfB, Complex[] a, int order, Complex[] b)
public virtual void LUSolve(int columnsOfB, Complex[] a, int order, Complex[] b)
{
if (a == null)
{
@ -1046,7 +1046,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRS LAPACK routine.</remarks>
public void LUSolveFactored(int columnsOfB, Complex[] a, int order, int[] ipiv, Complex[] b)
public virtual void LUSolveFactored(int columnsOfB, Complex[] a, int order, int[] ipiv, Complex[] b)
{
if (a == null)
{
@ -1142,7 +1142,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRF and GETRS LAPACK routines.</remarks>
public void LUSolve(Transpose transposeA, int columnsOfB, Complex[] a, int order, Complex[] b)
public virtual void LUSolve(Transpose transposeA, int columnsOfB, Complex[] a, int order, Complex[] b)
{
if (a == null)
{
@ -1179,7 +1179,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRS LAPACK routine.</remarks>
public void LUSolveFactored(Transpose transposeA, int columnsOfB, Complex[] a, int order, int[] ipiv, Complex[] b)
public virtual void LUSolveFactored(Transpose transposeA, int columnsOfB, Complex[] a, int order, int[] ipiv, Complex[] b)
{
if (a == null)
{
@ -1250,7 +1250,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// the Cholesky factorization.</param>
/// <param name="order">The number of rows or columns in the matrix.</param>
/// <remarks>This is equivalent to the POTRF LAPACK routine.</remarks>
public void CholeskyFactor(Complex[] a, int order)
public virtual void CholeskyFactor(Complex[] a, int order)
{
if (a == null)
{
@ -1338,7 +1338,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="rowsB">The number of rows in the B matrix.</param>
/// <param name="columnsB">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 orderA, Complex[] b, int rowsB, int columnsB)
public virtual void CholeskySolve(Complex[] a, int orderA, Complex[] b, int rowsB, int columnsB)
{
if (a == null)
{
@ -1373,7 +1373,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="rowsB">The number of rows in the B matrix.</param>
/// <param name="columnsB">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 orderA, Complex[] b, int rowsB, int columnsB)
public virtual void CholeskySolveFactored(Complex[] a, int orderA, Complex[] b, int rowsB, int columnsB)
{
if (a == null)
{
@ -1440,7 +1440,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsR, int columnsR, Complex[] q)
public virtual void QRFactor(Complex[] r, int rowsR, int columnsR, Complex[] q)
{
if (r == null)
{
@ -1479,7 +1479,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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>
public void QRFactor(Complex[] r, int rowsR, int columnsR, Complex[] q, Complex[] work)
public virtual void QRFactor(Complex[] r, int rowsR, int columnsR, Complex[] q, Complex[] work)
{
if (r == null)
{
@ -1643,7 +1643,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(Complex[] r, int rowsR, int columnsR, Complex[] q, Complex[] b, int columnsB, Complex[] x)
public virtual void QRSolve(Complex[] r, int rowsR, int columnsR, Complex[] q, Complex[] b, int columnsB, Complex[] x)
{
if (r == null)
{
@ -1704,7 +1704,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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(Complex[] r, int rowsR, int columnsR, Complex[] q, Complex[] b, int columnsB, Complex[] x, Complex[] work)
public virtual void QRSolve(Complex[] r, int rowsR, int columnsR, Complex[] q, Complex[] b, int columnsB, Complex[] x, Complex[] work)
{
if (r == null)
{
@ -1768,7 +1768,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(Complex[] q, Complex[] r, int rowsR, int columnsR, Complex[] b, int columnsB, Complex[] x)
public virtual void QRSolveFactored(Complex[] q, Complex[] r, int rowsR, int columnsR, Complex[] b, int columnsB, Complex[] x)
{
if (r == null)
{
@ -1876,7 +1876,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt)
public virtual void SingularValueDecomposition(bool computeVectors, Complex[] a, int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt)
{
if (a == null)
{
@ -1934,7 +1934,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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, int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt, Complex[] work)
public virtual void SingularValueDecomposition(bool computeVectors, Complex[] a, int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt, Complex[] work)
{
if (a == null)
{
@ -2616,7 +2616,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(Complex[] a, int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int columnsB, Complex[] x)
public virtual void SvdSolve(Complex[] a, int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int columnsB, Complex[] x)
{
if (a == null)
{
@ -2693,7 +2693,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int columnsB, Complex[] x, Complex[] work)
public virtual void SvdSolve(Complex[] a, int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int columnsB, Complex[] x, Complex[] work)
{
if (a == null)
{
@ -2776,7 +2776,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int columnsB, Complex[] x)
public virtual void SvdSolveFactored(int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt, Complex[] b, int columnsB, Complex[] x)
{
if (s == null)
{

66
src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs

@ -42,7 +42,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="alpha">The value to scale <paramref name="x"/> by.</param>
/// <param name="x">The vector to add to <paramref name="y"/>.</param>
/// <remarks>This equivalent to the AXPY BLAS routine.</remarks>
public void AddVectorToScaledVector(Complex32[] y, Complex32 alpha, Complex32[] x)
public virtual void AddVectorToScaledVector(Complex32[] y, Complex32 alpha, Complex32[] x)
{
if (y == null)
{
@ -80,7 +80,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="alpha">The scalar.</param>
/// <param name="x">The values to scale.</param>
/// <remarks>This is equivalent to the SCAL BLAS routine.</remarks>
public void ScaleArray(Complex32 alpha, Complex32[] x)
public virtual void ScaleArray(Complex32 alpha, Complex32[] x)
{
if (x == null)
{
@ -102,7 +102,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="y">The vector y.</param>
/// <returns>The dot product of x and y.</returns>
/// <remarks>This is equivalent to the DOT BLAS routine.</remarks>
public Complex32 DotProduct(Complex32[] x, Complex32[] y)
public virtual Complex32 DotProduct(Complex32[] x, Complex32[] y)
{
if (y == null)
{
@ -139,7 +139,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void AddArrays(Complex32[] x, Complex32[] y, Complex32[] result)
public virtual void AddArrays(Complex32[] x, Complex32[] y, Complex32[] result)
{
if (y == null)
{
@ -174,7 +174,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void SubtractArrays(Complex32[] x, Complex32[] y, Complex32[] result)
public virtual void SubtractArrays(Complex32[] x, Complex32[] y, Complex32[] result)
{
if (y == null)
{
@ -209,7 +209,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void PointWiseMultiplyArrays(Complex32[] x, Complex32[] y, Complex32[] result)
public virtual void PointWiseMultiplyArrays(Complex32[] x, Complex32[] y, Complex32[] result)
{
if (y == null)
{
@ -244,7 +244,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void PointWiseDivideArrays(Complex32[] x, Complex32[] y, Complex32[] result)
public virtual void PointWiseDivideArrays(Complex32[] x, Complex32[] y, Complex32[] result)
{
if (y == null)
{
@ -279,7 +279,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
/// </returns>
public Complex32 MatrixNorm(Norm norm, int rows, int columns, Complex32[] matrix)
public virtual Complex32 MatrixNorm(Norm norm, int rows, int columns, Complex32[] matrix)
{
var ret = 0.0;
switch (norm)
@ -349,7 +349,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
/// </returns>
public Complex32 MatrixNorm(Norm norm, int rows, int columns, Complex32[] matrix, Complex32[] work)
public virtual Complex32 MatrixNorm(Norm norm, int rows, int columns, Complex32[] matrix, Complex32[] work)
{
return MatrixNorm(norm, rows, columns, matrix);
}
@ -366,7 +366,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="result">Where to store the result of the multiplication.</param>
/// <remarks>This is a simplified version of the BLAS GEMM routine with alpha
/// set to 1.0 and beta set to 0.0, and x and y are not transposed.</remarks>
public void MatrixMultiply(Complex32[] x, int rowsX, int columnsX, Complex32[] y, int rowsY, int columnsY, Complex32[] result)
public virtual void MatrixMultiply(Complex32[] x, int rowsX, int columnsX, Complex32[] y, int rowsY, int columnsY, Complex32[] result)
{
// First check some basic requirement on the parameters of the matrix multiplication.
if (x == null)
@ -448,7 +448,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="columnsB">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>
public void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, Complex32 alpha, Complex32[] a, int rowsA, int columnsA, Complex32[] b, int rowsB, int columnsB, Complex32 beta, Complex32[] c)
public virtual void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, Complex32 alpha, Complex32[] a, int rowsA, int columnsA, Complex32[] b, int rowsB, int columnsB, Complex32 beta, Complex32[] c)
{
// Choose nonsensical values for the number of rows in c; fill them in depending
// on the operations on a and b.
@ -826,7 +826,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="data"/>.</param>
/// <param name="ipiv">On exit, it contains the pivot indices. The size of the array must be <paramref name="order"/>.</param>
/// <remarks>This is equivalent to the GETRF LAPACK routine.</remarks>
public void LUFactor(Complex32[] data, int order, int[] ipiv)
public virtual void LUFactor(Complex32[] data, int order, int[] ipiv)
{
if (data == null)
{
@ -924,7 +924,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="a">The N by N matrix to invert. Contains the inverse On exit.</param>
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
public void LUInverse(Complex32[] a, int order)
public virtual void LUInverse(Complex32[] a, int order)
{
if (a == null)
{
@ -948,7 +948,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
public void LUInverseFactored(Complex32[] a, int order, int[] ipiv)
public virtual void LUInverseFactored(Complex32[] a, int order, int[] ipiv)
{
if (a == null)
{
@ -989,7 +989,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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, int order, Complex32[] work)
public virtual void LUInverse(Complex32[] a, int order, Complex32[] work)
{
LUInverse(a, order);
}
@ -1004,7 +1004,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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 order, int[] ipiv, Complex32[] work)
public virtual void LUInverseFactored(Complex32[] a, int order, int[] ipiv, Complex32[] work)
{
LUInverseFactored(a, order, ipiv);
}
@ -1017,7 +1017,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRF and GETRS LAPACK routines.</remarks>
public void LUSolve(int columnsOfB, Complex32[] a, int order, Complex32[] b)
public virtual void LUSolve(int columnsOfB, Complex32[] a, int order, Complex32[] b)
{
if (a == null)
{
@ -1053,7 +1053,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRS LAPACK routine.</remarks>
public void LUSolveFactored(int columnsOfB, Complex32[] a, int order, int[] ipiv, Complex32[] b)
public virtual void LUSolveFactored(int columnsOfB, Complex32[] a, int order, int[] ipiv, Complex32[] b)
{
if (a == null)
{
@ -1149,7 +1149,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRF and GETRS LAPACK routines.</remarks>
public void LUSolve(Transpose transposeA, int columnsOfB, Complex32[] a, int order, Complex32[] b)
public virtual void LUSolve(Transpose transposeA, int columnsOfB, Complex32[] a, int order, Complex32[] b)
{
if (a == null)
{
@ -1186,7 +1186,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRS LAPACK routine.</remarks>
public void LUSolveFactored(Transpose transposeA, int columnsOfB, Complex32[] a, int order, int[] ipiv, Complex32[] b)
public virtual void LUSolveFactored(Transpose transposeA, int columnsOfB, Complex32[] a, int order, int[] ipiv, Complex32[] b)
{
if (a == null)
{
@ -1257,7 +1257,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// the Cholesky factorization.</param>
/// <param name="order">The number of rows or columns in the matrix.</param>
/// <remarks>This is equivalent to the POTRF LAPACK routine.</remarks>
public void CholeskyFactor(Complex32[] a, int order)
public virtual void CholeskyFactor(Complex32[] a, int order)
{
if (a == null)
{
@ -1345,7 +1345,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="rowsB">The number of rows in the B matrix.</param>
/// <param name="columnsB">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 orderA, Complex32[] b, int rowsB, int columnsB)
public virtual void CholeskySolve(Complex32[] a, int orderA, Complex32[] b, int rowsB, int columnsB)
{
if (a == null)
{
@ -1380,7 +1380,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="rowsB">The number of rows in the B matrix.</param>
/// <param name="columnsB">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 orderA, Complex32[] b, int rowsB, int columnsB)
public virtual void CholeskySolveFactored(Complex32[] a, int orderA, Complex32[] b, int rowsB, int columnsB)
{
if (a == null)
{
@ -1447,7 +1447,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsR, int columnsR, Complex32[] q)
public virtual void QRFactor(Complex32[] r, int rowsR, int columnsR, Complex32[] q)
{
if (r == null)
{
@ -1486,7 +1486,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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>
public void QRFactor(Complex32[] r, int rowsR, int columnsR, Complex32[] q, Complex32[] work)
public virtual void QRFactor(Complex32[] r, int rowsR, int columnsR, Complex32[] q, Complex32[] work)
{
if (r == null)
{
@ -1650,7 +1650,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(Complex32[] r, int rowsR, int columnsR, Complex32[] q, Complex32[] b, int columnsB, Complex32[] x)
public virtual void QRSolve(Complex32[] r, int rowsR, int columnsR, Complex32[] q, Complex32[] b, int columnsB, Complex32[] x)
{
if (r == null)
{
@ -1711,7 +1711,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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(Complex32[] r, int rowsR, int columnsR, Complex32[] q, Complex32[] b, int columnsB, Complex32[] x, Complex32[] work)
public virtual void QRSolve(Complex32[] r, int rowsR, int columnsR, Complex32[] q, Complex32[] b, int columnsB, Complex32[] x, Complex32[] work)
{
if (r == null)
{
@ -1775,7 +1775,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(Complex32[] q, Complex32[] r, int rowsR, int columnsR, Complex32[] b, int columnsB, Complex32[] x)
public virtual void QRSolveFactored(Complex32[] q, Complex32[] r, int rowsR, int columnsR, Complex32[] b, int columnsB, Complex32[] x)
{
if (r == null)
{
@ -1883,7 +1883,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt)
public virtual void SingularValueDecomposition(bool computeVectors, Complex32[] a, int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt)
{
if (a == null)
{
@ -1941,7 +1941,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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, int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work)
public virtual void SingularValueDecomposition(bool computeVectors, Complex32[] a, int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work)
{
if (a == null)
{
@ -2623,7 +2623,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(Complex32[] a, int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int columnsB, Complex32[] x)
public virtual void SvdSolve(Complex32[] a, int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int columnsB, Complex32[] x)
{
if (a == null)
{
@ -2700,7 +2700,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int columnsB, Complex32[] x, Complex32[] work)
public virtual void SvdSolve(Complex32[] a, int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int columnsB, Complex32[] x, Complex32[] work)
{
if (a == null)
{
@ -2783,7 +2783,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int columnsB, Complex32[] x)
public virtual void SvdSolveFactored(int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] b, int columnsB, Complex32[] x)
{
if (s == null)
{

66
src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Double.cs

@ -41,7 +41,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="alpha">The value to scale <paramref name="x"/> by.</param>
/// <param name="x">The vector to add to <paramref name="y"/>.</param>
/// <remarks>This equivalent to the AXPY BLAS routine.</remarks>
public void AddVectorToScaledVector(double[] y, double alpha, double[] x)
public virtual void AddVectorToScaledVector(double[] y, double alpha, double[] x)
{
if (y == null)
{
@ -79,7 +79,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="alpha">The scalar.</param>
/// <param name="x">The values to scale.</param>
/// <remarks>This is equivalent to the SCAL BLAS routine.</remarks>
public void ScaleArray(double alpha, double[] x)
public virtual void ScaleArray(double alpha, double[] x)
{
if (x == null)
{
@ -101,7 +101,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="y">The vector y.</param>
/// <returns>The dot product of x and y.</returns>
/// <remarks>This is equivalent to the DOT BLAS routine.</remarks>
public double DotProduct(double[] x, double[] y)
public virtual double DotProduct(double[] x, double[] y)
{
if (y == null)
{
@ -131,7 +131,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void AddArrays(double[] x, double[] y, double[] result)
public virtual void AddArrays(double[] x, double[] y, double[] result)
{
if (y == null)
{
@ -166,7 +166,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void SubtractArrays(double[] x, double[] y, double[] result)
public virtual void SubtractArrays(double[] x, double[] y, double[] result)
{
if (y == null)
{
@ -201,7 +201,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void PointWiseMultiplyArrays(double[] x, double[] y, double[] result)
public virtual void PointWiseMultiplyArrays(double[] x, double[] y, double[] result)
{
if (y == null)
{
@ -236,7 +236,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void PointWiseDivideArrays(double[] x, double[] y, double[] result)
public virtual void PointWiseDivideArrays(double[] x, double[] y, double[] result)
{
if (y == null)
{
@ -271,7 +271,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
/// </returns>
public double MatrixNorm(Norm norm, int rows, int columns, double[] matrix)
public virtual double MatrixNorm(Norm norm, int rows, int columns, double[] matrix)
{
var ret = 0.0;
switch (norm)
@ -340,7 +340,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
/// </returns>
public double MatrixNorm(Norm norm, int rows, int columns, double[] matrix, double[] work)
public virtual double MatrixNorm(Norm norm, int rows, int columns, double[] matrix, double[] work)
{
return MatrixNorm(norm, rows, columns, matrix);
}
@ -357,7 +357,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="result">Where to store the result of the multiplication.</param>
/// <remarks>This is a simplified version of the BLAS GEMM routine with alpha
/// set to 1.0 and beta set to 0.0, and x and y are not transposed.</remarks>
public void MatrixMultiply(double[] x, int rowsX, int columnsX, double[] y, int rowsY, int columnsY, double[] result)
public virtual void MatrixMultiply(double[] x, int rowsX, int columnsX, double[] y, int rowsY, int columnsY, double[] result)
{
// First check some basic requirement on the parameters of the matrix multiplication.
if (x == null)
@ -439,7 +439,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="columnsB">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>
public void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, double alpha, double[] a, int rowsA, int columnsA, double[] b, int rowsB, int columnsB, double beta, double[] c)
public virtual void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, double alpha, double[] a, int rowsA, int columnsA, double[] b, int rowsB, int columnsB, double beta, double[] c)
{
// Choose nonsensical values for the number of rows in c; fill them in depending
// on the operations on a and b.
@ -817,7 +817,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="data"/>.</param>
/// <param name="ipiv">On exit, it contains the pivot indices. The size of the array must be <paramref name="order"/>.</param>
/// <remarks>This is equivalent to the GETRF LAPACK routine.</remarks>
public void LUFactor(double[] data, int order, int[] ipiv)
public virtual void LUFactor(double[] data, int order, int[] ipiv)
{
if (data == null)
{
@ -915,7 +915,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="a">The N by N matrix to invert. Contains the inverse On exit.</param>
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
public void LUInverse(double[] a, int order)
public virtual void LUInverse(double[] a, int order)
{
if (a == null)
{
@ -939,7 +939,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
public void LUInverseFactored(double[] a, int order, int[] ipiv)
public virtual void LUInverseFactored(double[] a, int order, int[] ipiv)
{
if (a == null)
{
@ -980,7 +980,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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, int order, double[] work)
public virtual void LUInverse(double[] a, int order, double[] work)
{
LUInverse(a, order);
}
@ -995,7 +995,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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 order, int[] ipiv, double[] work)
public virtual void LUInverseFactored(double[] a, int order, int[] ipiv, double[] work)
{
LUInverseFactored(a, order, ipiv);
}
@ -1008,7 +1008,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRF and GETRS LAPACK routines.</remarks>
public void LUSolve(int columnsOfB, double[] a, int order, double[] b)
public virtual void LUSolve(int columnsOfB, double[] a, int order, double[] b)
{
if (a == null)
{
@ -1044,7 +1044,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRS LAPACK routine.</remarks>
public void LUSolveFactored(int columnsOfB, double[] a, int order, int[] ipiv, double[] b)
public virtual void LUSolveFactored(int columnsOfB, double[] a, int order, int[] ipiv, double[] b)
{
if (a == null)
{
@ -1140,7 +1140,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRF and GETRS LAPACK routines.</remarks>
public void LUSolve(Transpose transposeA, int columnsOfB, double[] a, int order, double[] b)
public virtual void LUSolve(Transpose transposeA, int columnsOfB, double[] a, int order, double[] b)
{
if (a == null)
{
@ -1177,7 +1177,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRS LAPACK routine.</remarks>
public void LUSolveFactored(Transpose transposeA, int columnsOfB, double[] a, int order, int[] ipiv, double[] b)
public virtual void LUSolveFactored(Transpose transposeA, int columnsOfB, double[] a, int order, int[] ipiv, double[] b)
{
if (a == null)
{
@ -1235,7 +1235,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// the Cholesky factorization.</param>
/// <param name="order">The number of rows or columns in the matrix.</param>
/// <remarks>This is equivalent to the POTRF LAPACK routine.</remarks>
public void CholeskyFactor(double[] a, int order)
public virtual void CholeskyFactor(double[] a, int order)
{
if (a == null)
{
@ -1323,7 +1323,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="rowsB">The number of rows in the B matrix.</param>
/// <param name="columnsB">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 orderA, double[] b, int rowsB, int columnsB)
public virtual void CholeskySolve(double[] a, int orderA, double[] b, int rowsB, int columnsB)
{
if (a == null)
{
@ -1358,7 +1358,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="rowsB">The number of rows in the B matrix.</param>
/// <param name="columnsB">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 orderA, double[] b, int rowsB, int columnsB)
public virtual void CholeskySolveFactored(double[] a, int orderA, double[] b, int rowsB, int columnsB)
{
if (a == null)
{
@ -1425,7 +1425,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsR, int columnsR, double[] q)
public virtual void QRFactor(double[] r, int rowsR, int columnsR, double[] q)
{
if (r == null)
{
@ -1464,7 +1464,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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>
public void QRFactor(double[] r, int rowsR, int columnsR, double[] q, double[] work)
public virtual void QRFactor(double[] r, int rowsR, int columnsR, double[] q, double[] work)
{
if (r == null)
{
@ -1629,7 +1629,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(double[] r, int rowsR, int columnsR, double[] q, double[] b, int columnsB, double[] x)
public virtual void QRSolve(double[] r, int rowsR, int columnsR, double[] q, double[] b, int columnsB, double[] x)
{
if (r == null)
{
@ -1690,7 +1690,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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(double[] r, int rowsR, int columnsR, double[] q, double[] b, int columnsB, double[] x, double[] work)
public virtual void QRSolve(double[] r, int rowsR, int columnsR, double[] q, double[] b, int columnsB, double[] x, double[] work)
{
if (r == null)
{
@ -1754,7 +1754,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(double[] q, double[] r, int rowsR, int columnsR, double[] b, int columnsB, double[] x)
public virtual void QRSolveFactored(double[] q, double[] r, int rowsR, int columnsR, double[] b, int columnsB, double[] x)
{
if (r == null)
{
@ -1862,7 +1862,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsA, int columnsA, double[] s, double[] u, double[] vt)
public virtual void SingularValueDecomposition(bool computeVectors, double[] a, int rowsA, int columnsA, double[] s, double[] u, double[] vt)
{
if (a == null)
{
@ -1920,7 +1920,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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, int rowsA, int columnsA, double[] s, double[] u, double[] vt, double[] work)
public virtual void SingularValueDecomposition(bool computeVectors, double[] a, int rowsA, int columnsA, double[] s, double[] u, double[] vt, double[] work)
{
if (a == null)
{
@ -2658,7 +2658,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(double[] a, int rowsA, int columnsA, double[] s, double[] u, double[] vt, double[] b, int columnsB, double[] x)
public virtual void SvdSolve(double[] a, int rowsA, int columnsA, double[] s, double[] u, double[] vt, double[] b, int columnsB, double[] x)
{
if (a == null)
{
@ -2735,7 +2735,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsA, int columnsA, double[] s, double[] u, double[] vt, double[] b, int columnsB, double[] x, double[] work)
public virtual void SvdSolve(double[] a, int rowsA, int columnsA, double[] s, double[] u, double[] vt, double[] b, int columnsB, double[] x, double[] work)
{
if (a == null)
{
@ -2818,7 +2818,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int rowsA, int columnsA, double[] s, double[] u, double[] vt, double[] b, int columnsB, double[] x)
public virtual void SvdSolveFactored(int rowsA, int columnsA, double[] s, double[] u, double[] vt, double[] b, int columnsB, double[] x)
{
if (s == null)
{

66
src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Single.cs

@ -42,7 +42,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="alpha">The value to scale <paramref name="x"/> by.</param>
/// <param name="x">The vector to add to <paramref name="y"/>.</param>
/// <remarks>This equivalent to the AXPY BLAS routine.</remarks>
public void AddVectorToScaledVector(float[] y, float alpha, float[] x)
public virtual void AddVectorToScaledVector(float[] y, float alpha, float[] x)
{
if (y == null)
{
@ -80,7 +80,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="alpha">The scalar.</param>
/// <param name="x">The values to scale.</param>
/// <remarks>This is equivalent to the SCAL BLAS routine.</remarks>
public void ScaleArray(float alpha, float[] x)
public virtual void ScaleArray(float alpha, float[] x)
{
if (x == null)
{
@ -102,7 +102,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="y">The vector y.</param>
/// <returns>The dot product of x and y.</returns>
/// <remarks>This is equivalent to the DOT BLAS routine.</remarks>
public float DotProduct(float[] x, float[] y)
public virtual float DotProduct(float[] x, float[] y)
{
if (y == null)
{
@ -134,7 +134,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void AddArrays(float[] x, float[] y, float[] result)
public virtual void AddArrays(float[] x, float[] y, float[] result)
{
if (y == null)
{
@ -169,7 +169,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void SubtractArrays(float[] x, float[] y, float[] result)
public virtual void SubtractArrays(float[] x, float[] y, float[] result)
{
if (y == null)
{
@ -204,7 +204,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void PointWiseMultiplyArrays(float[] x, float[] y, float[] result)
public virtual void PointWiseMultiplyArrays(float[] x, float[] y, float[] result)
{
if (y == null)
{
@ -239,7 +239,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <remarks>There is no equivalent BLAS routine, but many libraries
/// provide optimized (parallel and/or vectorized) versions of this
/// routine.</remarks>
public void PointWiseDivideArrays(float[] x, float[] y, float[] result)
public virtual void PointWiseDivideArrays(float[] x, float[] y, float[] result)
{
if (y == null)
{
@ -274,7 +274,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
/// </returns>
public float MatrixNorm(Norm norm, int rows, int columns, float[] matrix)
public virtual float MatrixNorm(Norm norm, int rows, int columns, float[] matrix)
{
var ret = 0.0;
switch (norm)
@ -344,7 +344,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <returns>
/// The requested <see cref="Norm"/> of the matrix.
/// </returns>
public float MatrixNorm(Norm norm, int rows, int columns, float[] matrix, float[] work)
public virtual float MatrixNorm(Norm norm, int rows, int columns, float[] matrix, float[] work)
{
return MatrixNorm(norm, rows, columns, matrix);
}
@ -361,7 +361,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="result">Where to store the result of the multiplication.</param>
/// <remarks>This is a simplified version of the BLAS GEMM routine with alpha
/// set to 1.0 and beta set to 0.0, and x and y are not transposed.</remarks>
public void MatrixMultiply(float[] x, int rowsX, int columnsX, float[] y, int rowsY, int columnsY, float[] result)
public virtual void MatrixMultiply(float[] x, int rowsX, int columnsX, float[] y, int rowsY, int columnsY, float[] result)
{
// First check some basic requirement on the parameters of the matrix multiplication.
if (x == null)
@ -443,7 +443,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="columnsB">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>
public void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, float alpha, float[] a, int rowsA, int columnsA, float[] b, int rowsB, int columnsB, float beta, float[] c)
public virtual void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, float alpha, float[] a, int rowsA, int columnsA, float[] b, int rowsB, int columnsB, float beta, float[] c)
{
// Choose nonsensical values for the number of rows in c; fill them in depending
// on the operations on a and b.
@ -821,7 +821,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="data"/>.</param>
/// <param name="ipiv">On exit, it contains the pivot indices. The size of the array must be <paramref name="order"/>.</param>
/// <remarks>This is equivalent to the GETRF LAPACK routine.</remarks>
public void LUFactor(float[] data, int order, int[] ipiv)
public virtual void LUFactor(float[] data, int order, int[] ipiv)
{
if (data == null)
{
@ -919,7 +919,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="a">The N by N matrix to invert. Contains the inverse On exit.</param>
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
public void LUInverse(float[] a, int order)
public virtual void LUInverse(float[] a, int order)
{
if (a == null)
{
@ -943,7 +943,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
public void LUInverseFactored(float[] a, int order, int[] ipiv)
public virtual void LUInverseFactored(float[] a, int order, int[] ipiv)
{
if (a == null)
{
@ -984,7 +984,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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, int order, float[] work)
public virtual void LUInverse(float[] a, int order, float[] work)
{
LUInverse(a, order);
}
@ -999,7 +999,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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 order, int[] ipiv, float[] work)
public virtual void LUInverseFactored(float[] a, int order, int[] ipiv, float[] work)
{
LUInverseFactored(a, order, ipiv);
}
@ -1012,7 +1012,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRF and GETRS LAPACK routines.</remarks>
public void LUSolve(int columnsOfB, float[] a, int order, float[] b)
public virtual void LUSolve(int columnsOfB, float[] a, int order, float[] b)
{
if (a == null)
{
@ -1048,7 +1048,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRS LAPACK routine.</remarks>
public void LUSolveFactored(int columnsOfB, float[] a, int order, int[] ipiv, float[] b)
public virtual void LUSolveFactored(int columnsOfB, float[] a, int order, int[] ipiv, float[] b)
{
if (a == null)
{
@ -1144,7 +1144,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRF and GETRS LAPACK routines.</remarks>
public void LUSolve(Transpose transposeA, int columnsOfB, float[] a, int order, float[] b)
public virtual void LUSolve(Transpose transposeA, int columnsOfB, float[] a, int order, float[] b)
{
if (a == null)
{
@ -1181,7 +1181,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="b">The B matrix.</param>
/// <remarks>This is equivalent to the GETRS LAPACK routine.</remarks>
public void LUSolveFactored(Transpose transposeA, int columnsOfB, float[] a, int order, int[] ipiv, float[] b)
public virtual void LUSolveFactored(Transpose transposeA, int columnsOfB, float[] a, int order, int[] ipiv, float[] b)
{
if (a == null)
{
@ -1239,7 +1239,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// the Cholesky factorization.</param>
/// <param name="order">The number of rows or columns in the matrix.</param>
/// <remarks>This is equivalent to the POTRF LAPACK routine.</remarks>
public void CholeskyFactor(float[] a, int order)
public virtual void CholeskyFactor(float[] a, int order)
{
if (a == null)
{
@ -1327,7 +1327,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="rowsB">The number of rows in the B matrix.</param>
/// <param name="columnsB">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 orderA, float[] b, int rowsB, int columnsB)
public virtual void CholeskySolve(float[] a, int orderA, float[] b, int rowsB, int columnsB)
{
if (a == null)
{
@ -1362,7 +1362,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="rowsB">The number of rows in the B matrix.</param>
/// <param name="columnsB">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 orderA, float[] b, int rowsB, int columnsB)
public virtual void CholeskySolveFactored(float[] a, int orderA, float[] b, int rowsB, int columnsB)
{
if (a == null)
{
@ -1429,7 +1429,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsR, int columnsR, float[] q)
public virtual void QRFactor(float[] r, int rowsR, int columnsR, float[] q)
{
if (r == null)
{
@ -1468,7 +1468,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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>
public void QRFactor(float[] r, int rowsR, int columnsR, float[] q, float[] work)
public virtual void QRFactor(float[] r, int rowsR, int columnsR, float[] q, float[] work)
{
if (r == null)
{
@ -1633,7 +1633,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolve(float[] r, int rowsR, int columnsR, float[] q, float[] b, int columnsB, float[] x)
public virtual void QRSolve(float[] r, int rowsR, int columnsR, float[] q, float[] b, int columnsB, float[] x)
{
if (r == null)
{
@ -1694,7 +1694,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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(float[] r, int rowsR, int columnsR, float[] q, float[] b, int columnsB, float[] x, float[] work)
public virtual void QRSolve(float[] r, int rowsR, int columnsR, float[] q, float[] b, int columnsB, float[] x, float[] work)
{
if (r == null)
{
@ -1758,7 +1758,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void QRSolveFactored(float[] q, float[] r, int rowsR, int columnsR, float[] b, int columnsB, float[] x)
public virtual void QRSolveFactored(float[] q, float[] r, int rowsR, int columnsR, float[] b, int columnsB, float[] x)
{
if (r == null)
{
@ -1866,7 +1866,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsA, int columnsA, float[] s, float[] u, float[] vt)
public virtual void SingularValueDecomposition(bool computeVectors, float[] a, int rowsA, int columnsA, float[] s, float[] u, float[] vt)
{
if (a == null)
{
@ -1924,7 +1924,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// 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, int rowsA, int columnsA, float[] s, float[] u, float[] vt, float[] work)
public virtual void SingularValueDecomposition(bool computeVectors, float[] a, int rowsA, int columnsA, float[] s, float[] u, float[] vt, float[] work)
{
if (a == null)
{
@ -2662,7 +2662,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolve(float[] a, int rowsA, int columnsA, float[] s, float[] u, float[] vt, float[] b, int columnsB, float[] x)
public virtual void SvdSolve(float[] a, int rowsA, int columnsA, float[] s, float[] u, float[] vt, float[] b, int columnsB, float[] x)
{
if (a == null)
{
@ -2739,7 +2739,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <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, int rowsA, int columnsA, float[] s, float[] u, float[] vt, float[] b, int columnsB, float[] x, float[] work)
public virtual void SvdSolve(float[] a, int rowsA, int columnsA, float[] s, float[] u, float[] vt, float[] b, int columnsB, float[] x, float[] work)
{
if (a == null)
{
@ -2822,7 +2822,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
/// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param>
public void SvdSolveFactored(int rowsA, int columnsA, float[] s, float[] u, float[] vt, float[] b, int columnsB, float[] x)
public virtual void SvdSolveFactored(int rowsA, int columnsA, float[] s, float[] u, float[] vt, float[] b, int columnsB, float[] x)
{
if (s == null)
{

10
src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex.tt

@ -0,0 +1,10 @@
<#@ template language="C#" debug="true" #>
<#@ output extenstion="cs" #>
<# string library = "Mkl";#>
<# string dataType = "Complex";#>
<# string zero = "Complex.Zero";#>
<# string one = "Complex.One";#>
<# string prefix = "z";#>
<# string reff = "ref ";#>
<#@ include file="..\NativeAlgebraProvider.include" #>

10
src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex32.tt

@ -0,0 +1,10 @@
<#@ template language="C#" debug="true" #>
<#@ output extenstion="cs" #>
<# string library = "Mkl";#>
<# string dataType = "Complex32";#>
<# string zero = "Complex32.Zero";#>
<# string one = "Complex32.One";#>
<# string prefix = "c";#>
<# string reff = "ref ";#>
<#@ include file="..\NativeAlgebraProvider.include" #>

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

File diff suppressed because it is too large

10
src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.double.tt

@ -0,0 +1,10 @@
<#@ template language="C#" debug="true" #>
<#@ output extenstion="cs" #>
<# string library = "Mkl";#>
<# string dataType = "double";#>
<# string zero = "0.0";#>
<# string one = "1.0";#>
<# string prefix = "d";#>
<# string reff = "";#>
<#@ include file="..\NativeAlgebraProvider.include" #>

10
src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.float.tt

@ -0,0 +1,10 @@
<#@ template language="C#" debug="true" #>
<#@ output extenstion="cs" #>
<# string library = "Mkl";#>
<# string dataType = "float";#>
<# string zero = "0.0f";#>
<# string one = "1.0f";#>
<# string prefix = "s";#>
<# string reff = "";#>
<#@ include file="..\NativeAlgebraProvider.include" #>

4
src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.tt

@ -1,4 +0,0 @@
<#@ template language="C#" debug="true" #>
<#@ output extenstion="cs" #>
<# string library = "Mkl";#>
<#@ include file="..\NativeAlgebraProvider.include" #>

160
src/Numerics/Algorithms/LinearAlgebra/Mkl/SafeNativeMethods.cs

@ -1,160 +0,0 @@
// <copyright file="SafeNativeMethods.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://mathnet.opensourcedotnet.info
//
// Copyright (c) 2009 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>
/* This file is automatically generated - do not modify it.
Change SafeNativeMethods.include instead.
Last generated on UTC 2010-06-09 08:17:20Z
*/
using System.Numerics;
using System.Runtime.InteropServices;
using System.Security;
namespace MathNet.Numerics.Algorithms.LinearAlgebra.Mkl
{
/// <summary>
/// P/Invoke methods to the native math libraries.
/// </summary>
[SuppressUnmanagedCodeSecurity]
internal static class SafeNativeMethods
{
/// <summary>
/// Name of the native DLL.
/// </summary>
private const string DllName = "MathNET.Numerics.MKL.dll";
#region BLAS
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void s_axpy(int n, float alpha, float[] x, [In, Out] float[] y);
[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 z_axpy(int n, ref Complex alpha, Complex[] x, [In, Out] Complex[] y);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void s_scale(int n, float alpha, [Out] float[] x);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void d_scale(int n, double alpha, [Out] double[] x);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void c_scale(int n, ref Complex32 alpha, [In, Out] Complex32[] x);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void z_scale(int n, ref Complex alpha, [In, Out] Complex[] x);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern float s_dot_product(int n, float[] x, float[] y);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern double d_dot_product(int n, double[] x, double[] y);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern Complex32 c_dot_product(int n, Complex32[] x, Complex32[] y);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern Complex z_dot_product(int n, Complex[] x, Complex[] y);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void s_matrix_multiply(Transpose transA, Transpose transB, int m, int n, int k, float alpha, float[] x, float[] y, float beta, [In, Out]float[] c);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void d_matrix_multiply(Transpose transA, Transpose transB, int m, int n, int k, double alpha, double[] x, double[] y, double beta, [In, Out]double[] c);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void c_matrix_multiply(Transpose transA, Transpose transB, int m, int n, int k, ref Complex32 alpha, Complex32[] x, Complex32[] y, ref Complex32 beta, [In, Out]Complex32[] c);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void z_matrix_multiply(Transpose transA, Transpose transB, int m, int n, int k, ref Complex alpha, Complex[] x, Complex[] y, ref Complex beta, [In, Out]Complex[] c);
#endregion BLAS
#region LAPACK
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void s_cholesky_factor(int n, [In, Out] float[] a);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void d_cholesky_factor(int n, [In, Out] double[] a);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void c_cholesky_factor(int n, [In, Out] Complex32[] a);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void z_cholesky_factor(int n, [In, Out] Complex[] a);
#endregion LAPACK
#region Vector Functions
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void s_vector_add(int n, float[] x, float[] y, [In, Out] float[] result);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void s_vector_subtract(int n, float[] x, float[] y, [In, Out] float[] result);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void s_vector_multiply(int n, float[] x, float[] y, [In, Out] float[] result);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void d_vector_add(int n, double[] x, double[] y, [In, Out] double[] result);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void d_vector_subtract(int n, double[] x, double[] y, [In, Out] double[] result);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void d_vector_multiply(int n, double[] x, double[] y, [In, Out] double[] result);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void c_vector_add(int n, Complex32[] x, Complex32[] y, [In, Out] Complex32[] result);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void c_vector_subtract(int n, Complex32[] x, Complex32[] y, [In, Out] Complex32[] result);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void c_vector_multiply(int n, Complex32[] x, Complex32[] y, [In, Out] Complex32[] result);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void z_vector_add(int n, Complex[] x, Complex[] y, [In, Out] Complex[] result);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void z_vector_subtract(int n, Complex[] x, Complex[] y, [In, Out] Complex[] result);
[DllImport(DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void z_vector_multiply(int n, Complex[] x, Complex[] y, [In, Out] Complex[] result);
#endregion Vector Functions
}
}

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

File diff suppressed because it is too large

45
src/Numerics/Numerics.csproj

@ -70,6 +70,26 @@
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="Algorithms\LinearAlgebra\Mkl\MklLinearAlgebraProvider.Complex32.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MklLinearAlgebraProvider.Complex32.cs</LastGenOutput>
</None>
<None Include="Algorithms\LinearAlgebra\Mkl\MklLinearAlgebraProvider.Complex.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MklLinearAlgebraProvider.Complex.cs</LastGenOutput>
</None>
<None Include="Algorithms\LinearAlgebra\Mkl\MklLinearAlgebraProvider.float.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MklLinearAlgebraProvider.float.cs</LastGenOutput>
</None>
<None Include="Algorithms\LinearAlgebra\Mkl\MklLinearAlgebraProvider.double.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MklLinearAlgebraProvider.double.cs</LastGenOutput>
</None>
<None Include="Algorithms\LinearAlgebra\Mkl\SafeNativeMethods.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>SafeNativeMethods.cs</LastGenOutput>
</None>
<None Include="Algorithms\LinearAlgebra\NativeAlgebraProvider.include" />
<Compile Include="Algorithms\LinearAlgebra\ManagedLinearAlgebraProvider.Complex32.cs" />
<Compile Include="Algorithms\LinearAlgebra\ManagedLinearAlgebraProvider.Complex.cs" />
@ -77,6 +97,31 @@
<Compile Include="Algorithms\LinearAlgebra\ILinearAlgebraProvider.cs" />
<Compile Include="Algorithms\LinearAlgebra\ILinearAlgebraProviderOfT.cs" />
<Compile Include="Algorithms\LinearAlgebra\ManagedLinearAlgebraProvider.Double.cs" />
<Compile Include="Algorithms\LinearAlgebra\Mkl\MklLinearAlgebraProvider.Complex32.cs">
<DependentUpon>MklLinearAlgebraProvider.Complex32.tt</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Algorithms\LinearAlgebra\Mkl\MklLinearAlgebraProvider.Complex.cs">
<DependentUpon>MklLinearAlgebraProvider.Complex.tt</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Algorithms\LinearAlgebra\Mkl\MklLinearAlgebraProvider.float.cs">
<DependentUpon>MklLinearAlgebraProvider.float.tt</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Algorithms\LinearAlgebra\Mkl\MklLinearAlgebraProvider.double.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MklLinearAlgebraProvider.double.tt</DependentUpon>
</Compile>
<Compile Include="Algorithms\LinearAlgebra\Mkl\SafeNativeMethods.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>SafeNativeMethods.tt</DependentUpon>
</Compile>
<Compile Include="Combinatorics.cs" />
<Compile Include="ComplexExtensions.cs" />
<Compile Include="Constants.cs" />

Loading…
Cancel
Save