|
|
|
@ -1,48 +1,4 @@ |
|
|
|
// <copyright file="<#=library#>LinearAlgebraProvider.<#=dataType#>.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 KINDC:\source\mathnet-marcus\src\Numerics\Algorithms\LinearAlgebra\NewFolder1\, |
|
|
|
// 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 NativeLinearAlgebraProvider.include instead. |
|
|
|
Last generated on UTC <#=DateTime.UtcNow.ToString("u")#> |
|
|
|
*/ |
|
|
|
|
|
|
|
namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#> |
|
|
|
{ |
|
|
|
using System; |
|
|
|
using System.Numerics; |
|
|
|
using Properties; |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// The managed linear algebra provider. |
|
|
|
/// </summary> |
|
|
|
public partial class <#=library#>LinearAlgebraProvider : ManagedLinearAlgebraProvider |
|
|
|
{ |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// Adds a scaled vector to another: <c>y += alpha*x</c>. |
|
|
|
/// </summary> |
|
|
|
/// <param name="y">The vector to update.</param> |
|
|
|
@ -122,149 +78,6 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#> |
|
|
|
return SafeNativeMethods.<#=prefix#>_dot_product(x.Length, x, y); |
|
|
|
} |
|
|
|
|
|
|
|
<# if( library.Equals("Mkl") ){ #> |
|
|
|
/// <summary> |
|
|
|
/// Does a point wise add of two arrays <c>z = x + y</c>. This can be used |
|
|
|
/// to add vectors or matrices. |
|
|
|
/// </summary> |
|
|
|
/// <param name="x">The array x.</param> |
|
|
|
/// <param name="y">The array y.</param> |
|
|
|
/// <param name="result">The result of the addition.</param> |
|
|
|
/// <remarks>There is no equivalent BLAS routine, but many libraries |
|
|
|
/// provide optimized (parallel and/or vectorized) versions of this |
|
|
|
/// routine.</remarks> |
|
|
|
public override void AddArrays(<#=dataType#>[] x, <#=dataType#>[] y, <#=dataType#>[] result) |
|
|
|
{ |
|
|
|
if (y == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("y"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x.Length != y.Length) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentArraysSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
if (x.Length != result.Length) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentArraysSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
SafeNativeMethods.<#=prefix#>_vector_add( x.Length, x, y, result ); |
|
|
|
} |
|
|
|
<#} #> |
|
|
|
|
|
|
|
<# if( library.Equals("Mkl") ){ #> |
|
|
|
/// <summary> |
|
|
|
/// Does a point wise subtraction of two arrays <c>z = x - y</c>. This can be used |
|
|
|
/// to subtract vectors or matrices. |
|
|
|
/// </summary> |
|
|
|
/// <param name="x">The array x.</param> |
|
|
|
/// <param name="y">The array y.</param> |
|
|
|
/// <param name="result">The result of the subtraction.</param> |
|
|
|
/// <remarks>There is no equivalent BLAS routine, but many libraries |
|
|
|
/// provide optimized (parallel and/or vectorized) versions of this |
|
|
|
/// routine.</remarks> |
|
|
|
public override void SubtractArrays(<#=dataType#>[] x, <#=dataType#>[] y, <#=dataType#>[] result) |
|
|
|
{ |
|
|
|
if (y == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("y"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x.Length != y.Length) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentArraysSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
if (x.Length != result.Length) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentArraysSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
SafeNativeMethods.<#=prefix#>_vector_subtract( x.Length, x, y, result ); |
|
|
|
} |
|
|
|
<#} #> |
|
|
|
|
|
|
|
<# if( library.Equals("Mkl") ){ #> |
|
|
|
/// <summary> |
|
|
|
/// Does a point wise multiplication of two arrays <c>z = x * y</c>. This can be used |
|
|
|
/// to multiple elements of vectors or matrices. |
|
|
|
/// </summary> |
|
|
|
/// <param name="x">The array x.</param> |
|
|
|
/// <param name="y">The array y.</param> |
|
|
|
/// <param name="result">The result of the point wise multiplication.</param> |
|
|
|
/// <remarks>There is no equivalent BLAS routine, but many libraries |
|
|
|
/// provide optimized (parallel and/or vectorized) versions of this |
|
|
|
/// routine.</remarks> |
|
|
|
public override void PointWiseMultiplyArrays(<#=dataType#>[] x, <#=dataType#>[] y, <#=dataType#>[] result) |
|
|
|
{ |
|
|
|
if (y == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("y"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x == null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (x.Length != y.Length) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentArraysSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
if (x.Length != result.Length) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentArraysSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
SafeNativeMethods.<#=prefix#>_vector_multiply( x.Length, x, y, result ); |
|
|
|
} |
|
|
|
<#} #> |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Computes the requested <see cref="Norm"/> of the matrix. |
|
|
|
/// </summary> |
|
|
|
/// <param name="norm">The type of norm to compute.</param> |
|
|
|
/// <param name="rows">The number of rows in the matrix.</param> |
|
|
|
/// <param name="columns">The number of columns in the matrix.</param> |
|
|
|
/// <param name="matrix">The matrix to compute the norm from.</param> |
|
|
|
/// <returns> |
|
|
|
/// The requested <see cref="Norm"/> of the matrix. |
|
|
|
/// </returns> |
|
|
|
public override <#=dataType#> MatrixNorm(Norm norm, int rows, int columns, <#=dataType#>[] matrix) |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Computes the requested <see cref="Norm"/> of the matrix. |
|
|
|
/// </summary> |
|
|
|
/// <param name="norm">The type of norm to compute.</param> |
|
|
|
/// <param name="rows">The number of rows in the matrix.</param> |
|
|
|
/// <param name="columns">The number of columns in the matrix.</param> |
|
|
|
/// <param name="matrix">The matrix to compute the norm from.</param> |
|
|
|
/// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/> |
|
|
|
/// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param> |
|
|
|
/// <returns> |
|
|
|
/// The requested <see cref="Norm"/> of the matrix. |
|
|
|
/// </returns> |
|
|
|
public override <#=dataType#> MatrixNorm(Norm norm, int rows, int columns, <#=dataType#>[] matrix, <#=dataType#>[] work) |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Multiples two matrices. <c>result = x * y</c> |
|
|
|
/// </summary> |
|
|
|
@ -330,6 +143,40 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#> |
|
|
|
|
|
|
|
SafeNativeMethods.<#=prefix#>_matrix_multiply(transposeA, transposeB, m, n, k, <#=reff#>alpha, a, b, <#=reff#>beta, c); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Computes the requested <see cref="Norm"/> of the matrix. |
|
|
|
/// </summary> |
|
|
|
/// <param name="norm">The type of norm to compute.</param> |
|
|
|
/// <param name="rows">The number of rows in the matrix.</param> |
|
|
|
/// <param name="columns">The number of columns in the matrix.</param> |
|
|
|
/// <param name="matrix">The matrix to compute the norm from.</param> |
|
|
|
/// <returns> |
|
|
|
/// The requested <see cref="Norm"/> of the matrix. |
|
|
|
/// </returns> |
|
|
|
public override <#=dataType#> MatrixNorm(Norm norm, int rows, int columns, <#=dataType#>[] matrix) |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Computes the requested <see cref="Norm"/> of the matrix. |
|
|
|
/// </summary> |
|
|
|
/// <param name="norm">The type of norm to compute.</param> |
|
|
|
/// <param name="rows">The number of rows in the matrix.</param> |
|
|
|
/// <param name="columns">The number of columns in the matrix.</param> |
|
|
|
/// <param name="matrix">The matrix to compute the norm from.</param> |
|
|
|
/// <param name="work">The work array. Only used when <see cref="Norm.InfinityNorm"/> |
|
|
|
/// and needs to be have a length of at least M (number of rows of <paramref name="matrix"/>.</param> |
|
|
|
/// <returns> |
|
|
|
/// The requested <see cref="Norm"/> of the matrix. |
|
|
|
/// </returns> |
|
|
|
public override <#=dataType#> MatrixNorm(Norm norm, int rows, int columns, <#=dataType#>[] matrix, <#=dataType#>[] work) |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Computes the LUP factorization of A. P*A = L*U. |
|
|
|
@ -680,5 +527,3 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#> |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |