diff --git a/.gitignore b/.gitignore
index 2acf9210..9177c990 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,4 +10,5 @@ _ReSharper*
bin
*.vsdoc
*.XML
-Version1.cs
\ No newline at end of file
+Version1.cs
+src/Numerics/Algorithms/LinearAlgebra/Mkl/*.cs
\ No newline at end of file
diff --git a/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex.tt b/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex.tt
index 4e3521ba..dc733440 100644
--- a/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex.tt
+++ b/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex.tt
@@ -1,10 +1,13 @@
<#@ template language="C#" debug="true" #>
<#@ output extenstion="cs" #>
<# string library = "Mkl";#>
+<# string title = "Intel's Math Kernel Library (MKL)";#>
<# string dataType = "Complex";#>
<# string zero = "Complex.Zero";#>
<# string one = "Complex.One";#>
<# string prefix = "z";#>
<# string reff = "ref ";#>
-
-<#@ include file="..\NativeAlgebraProvider.include" #>
\ No newline at end of file
+<#@ include file="..\native.header.include" #>
+<#@ include file="..\native.common.include" #>
+<#@ include file="..\native.vector.include" #>
+<#@ include file="..\native.footer.include" #>
diff --git a/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex32.tt b/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex32.tt
index f8ef5284..6ded98ca 100644
--- a/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex32.tt
+++ b/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex32.tt
@@ -1,10 +1,13 @@
<#@ template language="C#" debug="true" #>
<#@ output extenstion="cs" #>
<# string library = "Mkl";#>
+<# string title = "Intel's Math Kernel Library (MKL)";#>
<# string dataType = "Complex32";#>
<# string zero = "Complex32.Zero";#>
<# string one = "Complex32.One";#>
<# string prefix = "c";#>
<# string reff = "ref ";#>
-
-<#@ include file="..\NativeAlgebraProvider.include" #>
\ No newline at end of file
+<#@ include file="..\native.header.include" #>
+<#@ include file="..\native.common.include" #>
+<#@ include file="..\native.vector.include" #>
+<#@ include file="..\native.footer.include" #>
diff --git a/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.double.tt b/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.double.tt
index 69767282..18ffea33 100644
--- a/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.double.tt
+++ b/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.double.tt
@@ -1,10 +1,13 @@
<#@ template language="C#" debug="true" #>
<#@ output extenstion="cs" #>
<# string library = "Mkl";#>
+<# string title = "Intel's Math Kernel Library (MKL)";#>
<# string dataType = "double";#>
<# string zero = "0.0";#>
<# string one = "1.0";#>
<# string prefix = "d";#>
<# string reff = "";#>
-
-<#@ include file="..\NativeAlgebraProvider.include" #>
\ No newline at end of file
+<#@ include file="..\native.header.include" #>
+<#@ include file="..\native.common.include" #>
+<#@ include file="..\native.vector.include" #>
+<#@ include file="..\native.footer.include" #>
diff --git a/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.float.tt b/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.float.tt
index 68f10401..8feb4711 100644
--- a/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.float.tt
+++ b/src/Numerics/Algorithms/LinearAlgebra/Mkl/MklLinearAlgebraProvider.float.tt
@@ -1,10 +1,13 @@
<#@ template language="C#" debug="true" #>
<#@ output extenstion="cs" #>
<# string library = "Mkl";#>
+<# string title = "Intel's Math Kernel Library (MKL)";#>
<# string dataType = "float";#>
<# string zero = "0.0f";#>
<# string one = "1.0f";#>
<# string prefix = "s";#>
<# string reff = "";#>
-
-<#@ include file="..\NativeAlgebraProvider.include" #>
\ No newline at end of file
+<#@ include file="..\native.header.include" #>
+<#@ include file="..\native.common.include" #>
+<#@ include file="..\native.vector.include" #>
+<#@ include file="..\native.footer.include" #>
diff --git a/src/Numerics/Algorithms/LinearAlgebra/NativeAlgebraProvider.include b/src/Numerics/Algorithms/LinearAlgebra/native.common.include
similarity index 82%
rename from src/Numerics/Algorithms/LinearAlgebra/NativeAlgebraProvider.include
rename to src/Numerics/Algorithms/LinearAlgebra/native.common.include
index d09610ef..bd1019ed 100644
--- a/src/Numerics/Algorithms/LinearAlgebra/NativeAlgebraProvider.include
+++ b/src/Numerics/Algorithms/LinearAlgebra/native.common.include
@@ -1,48 +1,4 @@
-//
-// 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.
-//
-
-/* 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;
-
- ///
- /// The managed linear algebra provider.
- ///
- public partial class <#=library#>LinearAlgebraProvider : ManagedLinearAlgebraProvider
- {
- ///
+ ///
/// Adds a scaled vector to another: y += alpha*x.
///
/// The vector to update.
@@ -122,149 +78,6 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
return SafeNativeMethods.<#=prefix#>_dot_product(x.Length, x, y);
}
-<# if( library.Equals("Mkl") ){ #>
- ///
- /// Does a point wise add of two arrays z = x + y. This can be used
- /// to add vectors or matrices.
- ///
- /// The array x.
- /// The array y.
- /// The result of the addition.
- /// There is no equivalent BLAS routine, but many libraries
- /// provide optimized (parallel and/or vectorized) versions of this
- /// routine.
- 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") ){ #>
- ///
- /// Does a point wise subtraction of two arrays z = x - y. This can be used
- /// to subtract vectors or matrices.
- ///
- /// The array x.
- /// The array y.
- /// The result of the subtraction.
- /// There is no equivalent BLAS routine, but many libraries
- /// provide optimized (parallel and/or vectorized) versions of this
- /// routine.
- 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") ){ #>
- ///
- /// Does a point wise multiplication of two arrays z = x * y. This can be used
- /// to multiple elements of vectors or matrices.
- ///
- /// The array x.
- /// The array y.
- /// The result of the point wise multiplication.
- /// There is no equivalent BLAS routine, but many libraries
- /// provide optimized (parallel and/or vectorized) versions of this
- /// routine.
- 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 );
- }
-<#} #>
-
- ///
- /// Computes the requested of the matrix.
- ///
- /// The type of norm to compute.
- /// The number of rows in the matrix.
- /// The number of columns in the matrix.
- /// The matrix to compute the norm from.
- ///
- /// The requested of the matrix.
- ///
- public override <#=dataType#> MatrixNorm(Norm norm, int rows, int columns, <#=dataType#>[] matrix)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Computes the requested of the matrix.
- ///
- /// The type of norm to compute.
- /// The number of rows in the matrix.
- /// The number of columns in the matrix.
- /// The matrix to compute the norm from.
- /// The work array. Only used when
- /// and needs to be have a length of at least M (number of rows of .
- ///
- /// The requested of the matrix.
- ///
- public override <#=dataType#> MatrixNorm(Norm norm, int rows, int columns, <#=dataType#>[] matrix, <#=dataType#>[] work)
- {
- throw new NotImplementedException();
- }
-
///
/// Multiples two matrices. result = x * y
///
@@ -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);
}
+
+ ///
+ /// Computes the requested of the matrix.
+ ///
+ /// The type of norm to compute.
+ /// The number of rows in the matrix.
+ /// The number of columns in the matrix.
+ /// The matrix to compute the norm from.
+ ///
+ /// The requested of the matrix.
+ ///
+ public override <#=dataType#> MatrixNorm(Norm norm, int rows, int columns, <#=dataType#>[] matrix)
+ {
+ throw new NotImplementedException();
+ }
+
+ ///
+ /// Computes the requested of the matrix.
+ ///
+ /// The type of norm to compute.
+ /// The number of rows in the matrix.
+ /// The number of columns in the matrix.
+ /// The matrix to compute the norm from.
+ /// The work array. Only used when
+ /// and needs to be have a length of at least M (number of rows of .
+ ///
+ /// The requested of the matrix.
+ ///
+ public override <#=dataType#> MatrixNorm(Norm norm, int rows, int columns, <#=dataType#>[] matrix, <#=dataType#>[] work)
+ {
+ throw new NotImplementedException();
+ }
+
+
///
/// Computes the LUP factorization of A. P*A = L*U.
@@ -680,5 +527,3 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
{
throw new NotImplementedException();
}
- }
-}
\ No newline at end of file
diff --git a/src/Numerics/Algorithms/LinearAlgebra/native.footer.include b/src/Numerics/Algorithms/LinearAlgebra/native.footer.include
new file mode 100644
index 00000000..ba5291f5
--- /dev/null
+++ b/src/Numerics/Algorithms/LinearAlgebra/native.footer.include
@@ -0,0 +1,2 @@
+ }
+}
\ No newline at end of file
diff --git a/src/Numerics/Algorithms/LinearAlgebra/native.header.include b/src/Numerics/Algorithms/LinearAlgebra/native.header.include
new file mode 100644
index 00000000..8ef87640
--- /dev/null
+++ b/src/Numerics/Algorithms/LinearAlgebra/native.header.include
@@ -0,0 +1,45 @@
+//
+// Math.NET Numerics, part of the Math.NET Project
+// http://numerics.mathdotnet.com
+// http://github.com/mathnet/mathnet-numerics
+// http://mathnetnumerics.codeplex.com
+//
+// Copyright (c) 2009-2010 Math.NET
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+/* This file is automatically generated - do not modify it.
+ Last generated on UTC <#=DateTime.UtcNow.ToString("u")#>
+*/
+
+namespace MathNet.Numerics.Algorithms.LinearAlgebra.<#=library#>
+{
+ using System;
+ using System.Numerics;
+ using Properties;
+
+ ///
+ /// <#=title#> linear algebra provider.
+ ///
+ public partial class <#=library#>LinearAlgebraProvider : ManagedLinearAlgebraProvider
+ {
diff --git a/src/Numerics/Algorithms/LinearAlgebra/native.vector.include b/src/Numerics/Algorithms/LinearAlgebra/native.vector.include
new file mode 100644
index 00000000..505c15e8
--- /dev/null
+++ b/src/Numerics/Algorithms/LinearAlgebra/native.vector.include
@@ -0,0 +1,104 @@
+ ///
+ /// Does a point wise add of two arrays z = x + y. This can be used
+ /// to add vectors or matrices.
+ ///
+ /// The array x.
+ /// The array y.
+ /// The result of the addition.
+ /// There is no equivalent BLAS routine, but many libraries
+ /// provide optimized (parallel and/or vectorized) versions of this
+ /// routine.
+ 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 );
+ }
+
+ ///
+ /// Does a point wise subtraction of two arrays z = x - y. This can be used
+ /// to subtract vectors or matrices.
+ ///
+ /// The array x.
+ /// The array y.
+ /// The result of the subtraction.
+ /// There is no equivalent BLAS routine, but many libraries
+ /// provide optimized (parallel and/or vectorized) versions of this
+ /// routine.
+ 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 );
+ }
+
+ ///
+ /// Does a point wise multiplication of two arrays z = x * y. This can be used
+ /// to multiple elements of vectors or matrices.
+ ///
+ /// The array x.
+ /// The array y.
+ /// The result of the point wise multiplication.
+ /// There is no equivalent BLAS routine, but many libraries
+ /// provide optimized (parallel and/or vectorized) versions of this
+ /// routine.
+ 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 );
+ }
\ No newline at end of file
diff --git a/src/Numerics/Numerics.csproj b/src/Numerics/Numerics.csproj
index 8564b599..20dc4381 100644
--- a/src/Numerics/Numerics.csproj
+++ b/src/Numerics/Numerics.csproj
@@ -70,6 +70,8 @@
+
+ TextTemplatingFileGeneratorMklLinearAlgebraProvider.Complex32.cs
@@ -90,7 +92,7 @@
TextTemplatingFileGeneratorSafeNativeMethods.cs
-
+
@@ -453,6 +455,7 @@
MathNet.Numerics.snk
+ SafeNativeMethods.cs