Browse Source

first take on removing work arrays and using LAPACKE in the MKL provider - native side

truncatednormal
Marcus Cuda 11 years ago
parent
commit
06008b1c88
  1. 1
      .gitignore
  2. 1247
      src/NativeProviders/MKL/lapack.cpp
  3. 17
      src/NativeProviders/MKL/lapack.h
  4. 4
      src/NativeProviders/Windows/MKL/MKLWrapper.vcxproj.filters
  5. 106
      src/Numerics/Exceptions.cs
  6. 270
      src/Numerics/Properties/Resources.Designer.cs
  7. 15
      src/Numerics/Properties/Resources.resx
  8. 477
      src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex.cs
  9. 478
      src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex32.cs
  10. 481
      src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Double.cs
  11. 472
      src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Single.cs
  12. 11
      src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs
  13. 64
      src/Numerics/Providers/LinearAlgebra/Mkl/SafeNativeMethods.cs
  14. 16
      src/UnitTests/LinearAlgebraProviderTests/Complex/LinearAlgebraProviderTests.cs
  15. 326
      src/UnitTests/UnitTests-MKL.csproj

1
.gitignore

@ -21,6 +21,7 @@ coverage.*
*.psess *.psess
*.vsp *.vsp
*.vspx *.vspx
*.lnt
# Caches # Caches
_ReSharper* _ReSharper*

1247
src/NativeProviders/MKL/lapack.cpp

File diff suppressed because it is too large

17
src/NativeProviders/MKL/lapack.h

@ -0,0 +1,17 @@
#pragma once
#include <memory>
#define MKL_Complex8 std::complex<float>
#define MKL_Complex16 std::complex<double>
#include "mkl.h"
const int INSUFFICIENT_MEMORY = -999999;
const int ALIGNMENT = 64;
//#define PTRALLOC( size, alignment ) LAPACKE_malloc( size )
//#define PTRFREE( p ) LAPACKE_free( p )
#define PTRALLOC( size, alignment ) mkl_malloc( size, alignment )
#define PTRFREE( p ) mkl_free( p )

4
src/NativeProviders/Windows/MKL/MKLWrapper.vcxproj.filters

@ -9,7 +9,7 @@
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter> </Filter>
<Filter Include="Resource Files"> <Filter Include="Source Files\Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter> </Filter>
@ -36,7 +36,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\..\MKL\resource.rc"> <ResourceCompile Include="..\..\MKL\resource.rc">
<Filter>Resource Files</Filter> <Filter>Source Files\Resource Files</Filter>
</ResourceCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

106
src/Numerics/Exceptions.cs

@ -53,6 +53,112 @@ namespace MathNet.Numerics
: base(info, context) : base(info, context)
{ {
} }
#endif
}
/// <summary>
/// An error occured calling native provider function.
/// </summary>
[Serializable]
public abstract class NativeInterfaceException : Exception
{
protected NativeInterfaceException()
{
}
protected NativeInterfaceException(string message)
: base(message)
{
}
protected NativeInterfaceException(string message, Exception innerException)
: base(message, innerException)
{
}
#if !PORTABLE
protected NativeInterfaceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
#endif
}
/// <summary>
/// An error occured calling native provider function.
/// </summary>
[Serializable]
public class InvalidParameterException : NativeInterfaceException
{
public InvalidParameterException()
: base(Resources.InvalidParameter)
{
}
public InvalidParameterException(int parameter)
: base(string.Format(Resources.InvalidParameterWithNumber, parameter))
{
}
public InvalidParameterException(int parameter, Exception innerException)
: base(string.Format(Resources.InvalidParameterWithNumber, parameter), innerException)
{
}
#if !PORTABLE
protected InvalidParameterException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
#endif
}
/// <summary>
/// Native provider was unable to allocate sufficent memory.
/// </summary>
[Serializable]
public class MemoryAllocationException : NativeInterfaceException
{
public MemoryAllocationException()
: base(Resources.MemoryAllocation)
{
}
public MemoryAllocationException(Exception innerException)
: base(Resources.MemoryAllocation, innerException)
{
}
#if !PORTABLE
protected MemoryAllocationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
#endif
}
/// <summary>
/// Native provider failed LU inversion do to a singular U matrix.
/// </summary>
[Serializable]
public class SingularUMatrixException : NativeInterfaceException
{
public SingularUMatrixException()
: base(Resources.SingularUMatrix)
{
}
public SingularUMatrixException(int element)
: base(string.Format(Resources.SingularUMatrixWithElement, element))
{
}
public SingularUMatrixException(int element, Exception innerException)
: base(string.Format(Resources.SingularUMatrixWithElement, element), innerException)
{
}
#if !PORTABLE
protected SingularUMatrixException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
#endif #endif
} }
} }

270
src/Numerics/Properties/Resources.Designer.cs

@ -8,12 +8,10 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using System.Reflection;
namespace MathNet.Numerics.Properties { namespace MathNet.Numerics.Properties {
using System; using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
@ -25,38 +23,29 @@ namespace MathNet.Numerics.Properties {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources { public class Resources {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() { internal Resources() {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager { public static global::System.Resources.ResourceManager ResourceManager {
get { get {
#if NET45REFLECTION if (object.ReferenceEquals(resourceMan, null)) {
if (object.ReferenceEquals(resourceMan, null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MathNet.Numerics.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly);
resourceMan = temp;
}
#else
if (object.ReferenceEquals(resourceMan, null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MathNet.Numerics.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MathNet.Numerics.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
#endif
return resourceMan; return resourceMan;
} }
} }
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
@ -70,7 +59,7 @@ namespace MathNet.Numerics.Properties {
resourceCulture = value; resourceCulture = value;
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The accuracy couldn&apos;t be reached with the specified number of iterations.. /// Looks up a localized string similar to The accuracy couldn&apos;t be reached with the specified number of iterations..
/// </summary> /// </summary>
@ -79,7 +68,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("AccuracyNotReached", resourceCulture); return ResourceManager.GetString("AccuracyNotReached", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The array arguments must have the same length.. /// Looks up a localized string similar to The array arguments must have the same length..
/// </summary> /// </summary>
@ -88,7 +77,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentArraysSameLength", resourceCulture); return ResourceManager.GetString("ArgumentArraysSameLength", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The given array is the wrong length. Should be {0}.. /// Looks up a localized string similar to The given array is the wrong length. Should be {0}..
/// </summary> /// </summary>
@ -97,7 +86,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentArrayWrongLength", resourceCulture); return ResourceManager.GetString("ArgumentArrayWrongLength", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The argument must be between 0 and 1.. /// Looks up a localized string similar to The argument must be between 0 and 1..
/// </summary> /// </summary>
@ -106,7 +95,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentBetween0And1", resourceCulture); return ResourceManager.GetString("ArgumentBetween0And1", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value cannot be in the range -1 &lt; x &lt; 1.. /// Looks up a localized string similar to Value cannot be in the range -1 &lt; x &lt; 1..
/// </summary> /// </summary>
@ -115,7 +104,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentCannotBeBetweenOneAndNegativeOne", resourceCulture); return ResourceManager.GetString("ArgumentCannotBeBetweenOneAndNegativeOne", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value must be even.. /// Looks up a localized string similar to Value must be even..
/// </summary> /// </summary>
@ -124,7 +113,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentEven", resourceCulture); return ResourceManager.GetString("ArgumentEven", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The histogram does not contain the value.. /// Looks up a localized string similar to The histogram does not contain the value..
/// </summary> /// </summary>
@ -133,7 +122,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentHistogramContainsNot", resourceCulture); return ResourceManager.GetString("ArgumentHistogramContainsNot", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value is expected to be between {0} and {1} (including {0} and {1}).. /// Looks up a localized string similar to Value is expected to be between {0} and {1} (including {0} and {1})..
/// </summary> /// </summary>
@ -142,7 +131,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentInIntervalXYInclusive", resourceCulture); return ResourceManager.GetString("ArgumentInIntervalXYInclusive", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to At least one item of {0} is a null reference (Nothing in Visual Basic).. /// Looks up a localized string similar to At least one item of {0} is a null reference (Nothing in Visual Basic)..
/// </summary> /// </summary>
@ -151,7 +140,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentItemNull", resourceCulture); return ResourceManager.GetString("ArgumentItemNull", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value must be greater than or equal to one.. /// Looks up a localized string similar to Value must be greater than or equal to one..
/// </summary> /// </summary>
@ -160,7 +149,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentLessThanOne", resourceCulture); return ResourceManager.GetString("ArgumentLessThanOne", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix dimensions must agree.. /// Looks up a localized string similar to Matrix dimensions must agree..
/// </summary> /// </summary>
@ -169,7 +158,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixDimensions", resourceCulture); return ResourceManager.GetString("ArgumentMatrixDimensions", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix dimensions must agree: {0}.. /// Looks up a localized string similar to Matrix dimensions must agree: {0}..
/// </summary> /// </summary>
@ -178,7 +167,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixDimensions1", resourceCulture); return ResourceManager.GetString("ArgumentMatrixDimensions1", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix dimensions must agree: op1 is {0}, op2 is {1}.. /// Looks up a localized string similar to Matrix dimensions must agree: op1 is {0}, op2 is {1}..
/// </summary> /// </summary>
@ -187,7 +176,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixDimensions2", resourceCulture); return ResourceManager.GetString("ArgumentMatrixDimensions2", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix dimensions must agree: op1 is {0}, op2 is {1}, op3 is {2}.. /// Looks up a localized string similar to Matrix dimensions must agree: op1 is {0}, op2 is {1}, op3 is {2}..
/// </summary> /// </summary>
@ -196,7 +185,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixDimensions3", resourceCulture); return ResourceManager.GetString("ArgumentMatrixDimensions3", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The requested matrix does not exist.. /// Looks up a localized string similar to The requested matrix does not exist..
/// </summary> /// </summary>
@ -205,7 +194,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixDoesNotExist", resourceCulture); return ResourceManager.GetString("ArgumentMatrixDoesNotExist", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The matrix indices must not be out of range of the given matrix.. /// Looks up a localized string similar to The matrix indices must not be out of range of the given matrix..
/// </summary> /// </summary>
@ -214,7 +203,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixIndexOutOfRange", resourceCulture); return ResourceManager.GetString("ArgumentMatrixIndexOutOfRange", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix must not be rank deficient.. /// Looks up a localized string similar to Matrix must not be rank deficient..
/// </summary> /// </summary>
@ -223,7 +212,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixNotRankDeficient", resourceCulture); return ResourceManager.GetString("ArgumentMatrixNotRankDeficient", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix must not be singular.. /// Looks up a localized string similar to Matrix must not be singular..
/// </summary> /// </summary>
@ -232,7 +221,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixNotSingular", resourceCulture); return ResourceManager.GetString("ArgumentMatrixNotSingular", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix must be positive definite.. /// Looks up a localized string similar to Matrix must be positive definite..
/// </summary> /// </summary>
@ -241,7 +230,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixPositiveDefinite", resourceCulture); return ResourceManager.GetString("ArgumentMatrixPositiveDefinite", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix column dimensions must agree.. /// Looks up a localized string similar to Matrix column dimensions must agree..
/// </summary> /// </summary>
@ -250,7 +239,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixSameColumnDimension", resourceCulture); return ResourceManager.GetString("ArgumentMatrixSameColumnDimension", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix row dimensions must agree.. /// Looks up a localized string similar to Matrix row dimensions must agree..
/// </summary> /// </summary>
@ -259,7 +248,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixSameRowDimension", resourceCulture); return ResourceManager.GetString("ArgumentMatrixSameRowDimension", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix must have exactly one column.. /// Looks up a localized string similar to Matrix must have exactly one column..
/// </summary> /// </summary>
@ -268,7 +257,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixSingleColumn", resourceCulture); return ResourceManager.GetString("ArgumentMatrixSingleColumn", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix must have exactly one column and row, thus have only one cell.. /// Looks up a localized string similar to Matrix must have exactly one column and row, thus have only one cell..
/// </summary> /// </summary>
@ -277,7 +266,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixSingleColumnRow", resourceCulture); return ResourceManager.GetString("ArgumentMatrixSingleColumnRow", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix must have exactly one row.. /// Looks up a localized string similar to Matrix must have exactly one row..
/// </summary> /// </summary>
@ -286,7 +275,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixSingleRow", resourceCulture); return ResourceManager.GetString("ArgumentMatrixSingleRow", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix must be square.. /// Looks up a localized string similar to Matrix must be square..
/// </summary> /// </summary>
@ -295,7 +284,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixSquare", resourceCulture); return ResourceManager.GetString("ArgumentMatrixSquare", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix must be symmetric.. /// Looks up a localized string similar to Matrix must be symmetric..
/// </summary> /// </summary>
@ -304,7 +293,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixSymmetric", resourceCulture); return ResourceManager.GetString("ArgumentMatrixSymmetric", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix must be symmetric positive definite.. /// Looks up a localized string similar to Matrix must be symmetric positive definite..
/// </summary> /// </summary>
@ -313,7 +302,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMatrixSymmetricPositiveDefinite", resourceCulture); return ResourceManager.GetString("ArgumentMatrixSymmetricPositiveDefinite", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to In the specified range, the minimum is greater than maximum.. /// Looks up a localized string similar to In the specified range, the minimum is greater than maximum..
/// </summary> /// </summary>
@ -322,7 +311,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMinValueGreaterThanMaxValue", resourceCulture); return ResourceManager.GetString("ArgumentMinValueGreaterThanMaxValue", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value must be positive.. /// Looks up a localized string similar to Value must be positive..
/// </summary> /// </summary>
@ -331,7 +320,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentMustBePositive", resourceCulture); return ResourceManager.GetString("ArgumentMustBePositive", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value must neither be infinite nor NaN.. /// Looks up a localized string similar to Value must neither be infinite nor NaN..
/// </summary> /// </summary>
@ -340,7 +329,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentNotInfinityNaN", resourceCulture); return ResourceManager.GetString("ArgumentNotInfinityNaN", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value must not be negative (zero is ok).. /// Looks up a localized string similar to Value must not be negative (zero is ok)..
/// </summary> /// </summary>
@ -349,7 +338,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentNotNegative", resourceCulture); return ResourceManager.GetString("ArgumentNotNegative", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to {0} is a null reference (Nothing in Visual Basic).. /// Looks up a localized string similar to {0} is a null reference (Nothing in Visual Basic)..
/// </summary> /// </summary>
@ -358,7 +347,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentNull", resourceCulture); return ResourceManager.GetString("ArgumentNull", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value must be odd.. /// Looks up a localized string similar to Value must be odd..
/// </summary> /// </summary>
@ -367,7 +356,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentOdd", resourceCulture); return ResourceManager.GetString("ArgumentOdd", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to {0} must be greater than {1}.. /// Looks up a localized string similar to {0} must be greater than {1}..
/// </summary> /// </summary>
@ -376,7 +365,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentOutOfRangeGreater", resourceCulture); return ResourceManager.GetString("ArgumentOutOfRangeGreater", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to {0} must be greater than or equal to {1}.. /// Looks up a localized string similar to {0} must be greater than or equal to {1}..
/// </summary> /// </summary>
@ -385,7 +374,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentOutOfRangeGreaterEqual", resourceCulture); return ResourceManager.GetString("ArgumentOutOfRangeGreaterEqual", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to {0} must be smaller than {1}.. /// Looks up a localized string similar to {0} must be smaller than {1}..
/// </summary> /// </summary>
@ -412,7 +401,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentParameterSetInvalid", resourceCulture); return ResourceManager.GetString("ArgumentParameterSetInvalid", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The given expression does not represent a complex number.. /// Looks up a localized string similar to The given expression does not represent a complex number..
/// </summary> /// </summary>
@ -421,7 +410,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentParseComplexNumber", resourceCulture); return ResourceManager.GetString("ArgumentParseComplexNumber", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value must be positive (and not zero).. /// Looks up a localized string similar to Value must be positive (and not zero)..
/// </summary> /// </summary>
@ -430,7 +419,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentPositive", resourceCulture); return ResourceManager.GetString("ArgumentPositive", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Size must be a Power of Two.. /// Looks up a localized string similar to Size must be a Power of Two..
/// </summary> /// </summary>
@ -439,7 +428,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentPowerOfTwo", resourceCulture); return ResourceManager.GetString("ArgumentPowerOfTwo", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Size must be a Power of Two in every dimension.. /// Looks up a localized string similar to Size must be a Power of Two in every dimension..
/// </summary> /// </summary>
@ -448,7 +437,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentPowerOfTwoEveryDimension", resourceCulture); return ResourceManager.GetString("ArgumentPowerOfTwoEveryDimension", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The range between {0} and {1} must be less than or equal to {2}.. /// Looks up a localized string similar to The range between {0} and {1} must be less than or equal to {2}..
/// </summary> /// </summary>
@ -457,7 +446,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentRangeLessEqual", resourceCulture); return ResourceManager.GetString("ArgumentRangeLessEqual", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Arguments must be different objects.. /// Looks up a localized string similar to Arguments must be different objects..
/// </summary> /// </summary>
@ -466,7 +455,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentReferenceDifferent", resourceCulture); return ResourceManager.GetString("ArgumentReferenceDifferent", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Array must have exactly one dimension (and not be null).. /// Looks up a localized string similar to Array must have exactly one dimension (and not be null)..
/// </summary> /// </summary>
@ -475,7 +464,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentSingleDimensionArray", resourceCulture); return ResourceManager.GetString("ArgumentSingleDimensionArray", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value is too large.. /// Looks up a localized string similar to Value is too large..
/// </summary> /// </summary>
@ -484,7 +473,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentTooLarge", resourceCulture); return ResourceManager.GetString("ArgumentTooLarge", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value is too large for the current iteration limit.. /// Looks up a localized string similar to Value is too large for the current iteration limit..
/// </summary> /// </summary>
@ -493,7 +482,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentTooLargeForIterationLimit", resourceCulture); return ResourceManager.GetString("ArgumentTooLargeForIterationLimit", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Type mismatch.. /// Looks up a localized string similar to Type mismatch..
/// </summary> /// </summary>
@ -502,7 +491,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentTypeMismatch", resourceCulture); return ResourceManager.GetString("ArgumentTypeMismatch", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The upper bound must be strictly larger than the lower bound.. /// Looks up a localized string similar to The upper bound must be strictly larger than the lower bound..
/// </summary> /// </summary>
@ -511,7 +500,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentUpperBoundMustBeLargerThanLowerBound", resourceCulture); return ResourceManager.GetString("ArgumentUpperBoundMustBeLargerThanLowerBound", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The upper bound must be at least as large as the lower bound.. /// Looks up a localized string similar to The upper bound must be at least as large as the lower bound..
/// </summary> /// </summary>
@ -520,7 +509,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentUpperBoundMustBeLargerThanOrEqualToLowerBound", resourceCulture); return ResourceManager.GetString("ArgumentUpperBoundMustBeLargerThanOrEqualToLowerBound", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Array length must be a multiple of {0}.. /// Looks up a localized string similar to Array length must be a multiple of {0}..
/// </summary> /// </summary>
@ -529,7 +518,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentVectorLengthsMultipleOf", resourceCulture); return ResourceManager.GetString("ArgumentVectorLengthsMultipleOf", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to All vectors must have the same dimensionality.. /// Looks up a localized string similar to All vectors must have the same dimensionality..
/// </summary> /// </summary>
@ -538,7 +527,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentVectorsSameLength", resourceCulture); return ResourceManager.GetString("ArgumentVectorsSameLength", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The vector must have 3 dimensions.. /// Looks up a localized string similar to The vector must have 3 dimensions..
/// </summary> /// </summary>
@ -547,7 +536,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArgumentVectorThreeDimensional", resourceCulture); return ResourceManager.GetString("ArgumentVectorThreeDimensional", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The given array is too small. It must be at least {0} long.. /// Looks up a localized string similar to The given array is too small. It must be at least {0} long..
/// </summary> /// </summary>
@ -556,7 +545,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ArrayTooSmall", resourceCulture); return ResourceManager.GetString("ArrayTooSmall", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Big endian files are not supported.. /// Looks up a localized string similar to Big endian files are not supported..
/// </summary> /// </summary>
@ -565,7 +554,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("BigEndianNotSupported", resourceCulture); return ResourceManager.GetString("BigEndianNotSupported", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The supplied collection is empty.. /// Looks up a localized string similar to The supplied collection is empty..
/// </summary> /// </summary>
@ -574,7 +563,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("CollectionEmpty", resourceCulture); return ResourceManager.GetString("CollectionEmpty", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Complex matrices are not supported.. /// Looks up a localized string similar to Complex matrices are not supported..
/// </summary> /// </summary>
@ -583,7 +572,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ComplexMatricesNotSupported", resourceCulture); return ResourceManager.GetString("ComplexMatricesNotSupported", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to An algorithm failed to converge.. /// Looks up a localized string similar to An algorithm failed to converge..
/// </summary> /// </summary>
@ -592,7 +581,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ConvergenceFailed", resourceCulture); return ResourceManager.GetString("ConvergenceFailed", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to This feature is not implemented yet (but is planned).. /// Looks up a localized string similar to This feature is not implemented yet (but is planned)..
/// </summary> /// </summary>
@ -601,7 +590,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("FeaturePlannedButNotImplementedYet", resourceCulture); return ResourceManager.GetString("FeaturePlannedButNotImplementedYet", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The given file doesn&apos;t exist.. /// Looks up a localized string similar to The given file doesn&apos;t exist..
/// </summary> /// </summary>
@ -610,7 +599,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("FileDoesNotExist", resourceCulture); return ResourceManager.GetString("FileDoesNotExist", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Sample points should be sorted in strictly ascending order. /// Looks up a localized string similar to Sample points should be sorted in strictly ascending order.
/// </summary> /// </summary>
@ -619,7 +608,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("Interpolation_Initialize_SamplePointsNotStrictlyAscendingOrder", resourceCulture); return ResourceManager.GetString("Interpolation_Initialize_SamplePointsNotStrictlyAscendingOrder", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to All sample points should be unique.. /// Looks up a localized string similar to All sample points should be unique..
/// </summary> /// </summary>
@ -628,7 +617,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("Interpolation_Initialize_SamplePointsNotUnique", resourceCulture); return ResourceManager.GetString("Interpolation_Initialize_SamplePointsNotUnique", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Invalid parameterization for the distribution.. /// Looks up a localized string similar to Invalid parameterization for the distribution..
/// </summary> /// </summary>
@ -637,7 +626,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("InvalidDistributionParameters", resourceCulture); return ResourceManager.GetString("InvalidDistributionParameters", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Invalid Left Boundary Condition.. /// Looks up a localized string similar to Invalid Left Boundary Condition..
/// </summary> /// </summary>
@ -646,7 +635,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("InvalidLeftBoundaryCondition", resourceCulture); return ResourceManager.GetString("InvalidLeftBoundaryCondition", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The operation could not be performed because the accumulator is empty.. /// Looks up a localized string similar to The operation could not be performed because the accumulator is empty..
/// </summary> /// </summary>
@ -655,7 +644,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("InvalidOperationAccumulatorEmpty", resourceCulture); return ResourceManager.GetString("InvalidOperationAccumulatorEmpty", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The operation could not be performed because the histogram is empty.. /// Looks up a localized string similar to The operation could not be performed because the histogram is empty..
/// </summary> /// </summary>
@ -664,7 +653,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("InvalidOperationHistogramEmpty", resourceCulture); return ResourceManager.GetString("InvalidOperationHistogramEmpty", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Not enough points in the distribution.. /// Looks up a localized string similar to Not enough points in the distribution..
/// </summary> /// </summary>
@ -673,7 +662,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("InvalidOperationHistogramNotEnoughPoints", resourceCulture); return ResourceManager.GetString("InvalidOperationHistogramNotEnoughPoints", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to No Samples Provided. Preparation Required.. /// Looks up a localized string similar to No Samples Provided. Preparation Required..
/// </summary> /// </summary>
@ -682,7 +671,25 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("InvalidOperationNoSamplesProvided", resourceCulture); return ResourceManager.GetString("InvalidOperationNoSamplesProvided", resourceCulture);
} }
} }
/// <summary>
/// Looks up a localized string similar to An invalid parameter was passed to a native method..
/// </summary>
public static string InvalidParameter {
get {
return ResourceManager.GetString("InvalidParameter", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to An invalid parameter was passed to a native method, parameter number : {0}.
/// </summary>
public static string InvalidParameterWithNumber {
get {
return ResourceManager.GetString("InvalidParameterWithNumber", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Invalid Right Boundary Condition.. /// Looks up a localized string similar to Invalid Right Boundary Condition..
/// </summary> /// </summary>
@ -691,7 +698,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("InvalidRightBoundaryCondition", resourceCulture); return ResourceManager.GetString("InvalidRightBoundaryCondition", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Lag must be positive. /// Looks up a localized string similar to Lag must be positive.
/// </summary> /// </summary>
@ -700,7 +707,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("LagMustBePositive", resourceCulture); return ResourceManager.GetString("LagMustBePositive", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Lag must be smaller than the sample size. /// Looks up a localized string similar to Lag must be smaller than the sample size.
/// </summary> /// </summary>
@ -709,7 +716,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("LagMustBeSmallerThanTheSampleSize", resourceCulture); return ResourceManager.GetString("LagMustBeSmallerThanTheSampleSize", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to ddd MMM dd HH:mm:ss yyyy. /// Looks up a localized string similar to ddd MMM dd HH:mm:ss yyyy.
/// </summary> /// </summary>
@ -718,7 +725,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("MatlabDateHeaderFormat", resourceCulture); return ResourceManager.GetString("MatlabDateHeaderFormat", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrices can not be empty and must have at least one row and column.. /// Looks up a localized string similar to Matrices can not be empty and must have at least one row and column..
/// </summary> /// </summary>
@ -727,7 +734,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("MatrixCanNotBeEmpty", resourceCulture); return ResourceManager.GetString("MatrixCanNotBeEmpty", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The number of columns of a matrix must be positive.. /// Looks up a localized string similar to The number of columns of a matrix must be positive..
/// </summary> /// </summary>
@ -736,7 +743,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("MatrixColumnsMustBePositive", resourceCulture); return ResourceManager.GetString("MatrixColumnsMustBePositive", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Matrix must be in sparse storage format. /// Looks up a localized string similar to Matrix must be in sparse storage format.
/// </summary> /// </summary>
@ -745,7 +752,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("MatrixMustBeSparse", resourceCulture); return ResourceManager.GetString("MatrixMustBeSparse", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The number of rows of a matrix must be positive.. /// Looks up a localized string similar to The number of rows of a matrix must be positive..
/// </summary> /// </summary>
@ -754,7 +761,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("MatrixRowsMustBePositive", resourceCulture); return ResourceManager.GetString("MatrixRowsMustBePositive", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The number of rows or columns of a matrix must be positive.. /// Looks up a localized string similar to The number of rows or columns of a matrix must be positive..
/// </summary> /// </summary>
@ -763,7 +770,16 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("MatrixRowsOrColumnsMustBePositive", resourceCulture); return ResourceManager.GetString("MatrixRowsOrColumnsMustBePositive", resourceCulture);
} }
} }
/// <summary>
/// Looks up a localized string similar to Unable to allocate native memory..
/// </summary>
public static string MemoryAllocation {
get {
return ResourceManager.GetString("MemoryAllocation", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Only 1 and 2 dimensional arrays are supported.. /// Looks up a localized string similar to Only 1 and 2 dimensional arrays are supported..
/// </summary> /// </summary>
@ -772,7 +788,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("MoreThan2D", resourceCulture); return ResourceManager.GetString("MoreThan2D", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Data must contain at least {0} values.. /// Looks up a localized string similar to Data must contain at least {0} values..
/// </summary> /// </summary>
@ -781,7 +797,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("MustContainAtLeast", resourceCulture); return ResourceManager.GetString("MustContainAtLeast", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Name cannot contain a space. name: {0}. /// Looks up a localized string similar to Name cannot contain a space. name: {0}.
/// </summary> /// </summary>
@ -790,7 +806,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("NameCannotContainASpace", resourceCulture); return ResourceManager.GetString("NameCannotContainASpace", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to {0} is not a supported type.. /// Looks up a localized string similar to {0} is not a supported type..
/// </summary> /// </summary>
@ -799,7 +815,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("NotSupportedType", resourceCulture); return ResourceManager.GetString("NotSupportedType", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Algorithm experience a numerical break down /// Looks up a localized string similar to Algorithm experience a numerical break down
///. ///.
@ -809,7 +825,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("NumericalBreakdown", resourceCulture); return ResourceManager.GetString("NumericalBreakdown", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The two arguments can&apos;t be compared (maybe they are part of a partial ordering?). /// Looks up a localized string similar to The two arguments can&apos;t be compared (maybe they are part of a partial ordering?).
/// </summary> /// </summary>
@ -818,7 +834,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("PartialOrderException", resourceCulture); return ResourceManager.GetString("PartialOrderException", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The integer array does not represent a valid permutation.. /// Looks up a localized string similar to The integer array does not represent a valid permutation..
/// </summary> /// </summary>
@ -827,7 +843,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("PermutationAsIntArrayInvalid", resourceCulture); return ResourceManager.GetString("PermutationAsIntArrayInvalid", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The sampler&apos;s proposal distribution is not upper bounding the target density.. /// Looks up a localized string similar to The sampler&apos;s proposal distribution is not upper bounding the target density..
/// </summary> /// </summary>
@ -836,7 +852,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("ProposalDistributionNoUpperBound", resourceCulture); return ResourceManager.GetString("ProposalDistributionNoUpperBound", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The algorithm has failed, exceeded the number of iterations allowed or there is no root within the provided bounds.. /// Looks up a localized string similar to The algorithm has failed, exceeded the number of iterations allowed or there is no root within the provided bounds..
/// </summary> /// </summary>
@ -845,7 +861,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("RootFindingFailed", resourceCulture); return ResourceManager.GetString("RootFindingFailed", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The algorithm has failed, exceeded the number of iterations allowed or there is no root within the provided bounds. Consider to use RobustNewtonRaphson instead.. /// Looks up a localized string similar to The algorithm has failed, exceeded the number of iterations allowed or there is no root within the provided bounds. Consider to use RobustNewtonRaphson instead..
/// </summary> /// </summary>
@ -854,7 +870,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("RootFindingFailedRecommendRobustNewtonRaphson", resourceCulture); return ResourceManager.GetString("RootFindingFailedRecommendRobustNewtonRaphson", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The lower and upper bounds must bracket a single root.. /// Looks up a localized string similar to The lower and upper bounds must bracket a single root..
/// </summary> /// </summary>
@ -863,7 +879,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("RootMustBeBracketedByBounds", resourceCulture); return ResourceManager.GetString("RootMustBeBracketedByBounds", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The algorithm ended without root in the range.. /// Looks up a localized string similar to The algorithm ended without root in the range..
/// </summary> /// </summary>
@ -872,7 +888,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("RootNotFound", resourceCulture); return ResourceManager.GetString("RootNotFound", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The number of rows must greater than or equal to the number of columns.. /// Looks up a localized string similar to The number of rows must greater than or equal to the number of columns..
/// </summary> /// </summary>
@ -881,7 +897,25 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("RowsLessThanColumns", resourceCulture); return ResourceManager.GetString("RowsLessThanColumns", resourceCulture);
} }
} }
/// <summary>
/// Looks up a localized string similar to U is singular, and the inversion could not be completed..
/// </summary>
public static string SingularUMatrix {
get {
return ResourceManager.GetString("SingularUMatrix", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to U is singular, and the inversion could not be completed. The {0}-th diagonal element of the factor U is zero..
/// </summary>
public static string SingularUMatrixWithElement {
get {
return ResourceManager.GetString("SingularUMatrixWithElement", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to The singular vectors were not computed.. /// Looks up a localized string similar to The singular vectors were not computed..
/// </summary> /// </summary>
@ -890,7 +924,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("SingularVectorsNotComputed", resourceCulture); return ResourceManager.GetString("SingularVectorsNotComputed", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to This special case is not supported yet (but is planned).. /// Looks up a localized string similar to This special case is not supported yet (but is planned)..
/// </summary> /// </summary>
@ -899,7 +933,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("SpecialCasePlannedButNotImplementedYet", resourceCulture); return ResourceManager.GetString("SpecialCasePlannedButNotImplementedYet", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The given stop criterion already exist in the collection.. /// Looks up a localized string similar to The given stop criterion already exist in the collection..
/// </summary> /// </summary>
@ -908,7 +942,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("StopCriterionDuplicate", resourceCulture); return ResourceManager.GetString("StopCriterionDuplicate", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to There is no stop criterion in the collection.. /// Looks up a localized string similar to There is no stop criterion in the collection..
/// </summary> /// </summary>
@ -917,7 +951,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("StopCriterionMissing", resourceCulture); return ResourceManager.GetString("StopCriterionMissing", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to String parameter cannot be empty or null.. /// Looks up a localized string similar to String parameter cannot be empty or null..
/// </summary> /// </summary>
@ -926,7 +960,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("StringNullOrEmpty", resourceCulture); return ResourceManager.GetString("StringNullOrEmpty", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to We only support sparse matrix with less than int.MaxValue elements.. /// Looks up a localized string similar to We only support sparse matrix with less than int.MaxValue elements..
/// </summary> /// </summary>
@ -935,7 +969,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("TooManyElements", resourceCulture); return ResourceManager.GetString("TooManyElements", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The moment of the distribution is undefined.. /// Looks up a localized string similar to The moment of the distribution is undefined..
/// </summary> /// </summary>
@ -944,7 +978,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("UndefinedMoment", resourceCulture); return ResourceManager.GetString("UndefinedMoment", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to A user defined provider has not been specified.. /// Looks up a localized string similar to A user defined provider has not been specified..
/// </summary> /// </summary>
@ -953,7 +987,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("UserDefinedProviderNotSpecified", resourceCulture); return ResourceManager.GetString("UserDefinedProviderNotSpecified", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to User work buffers are not supported by this provider.. /// Looks up a localized string similar to User work buffers are not supported by this provider..
/// </summary> /// </summary>
@ -962,7 +996,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("UserWorkBufferNotSupported", resourceCulture); return ResourceManager.GetString("UserWorkBufferNotSupported", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Vectors can not be empty and must have at least one element.. /// Looks up a localized string similar to Vectors can not be empty and must have at least one element..
/// </summary> /// </summary>
@ -971,7 +1005,7 @@ namespace MathNet.Numerics.Properties {
return ResourceManager.GetString("VectorCanNotBeEmpty", resourceCulture); return ResourceManager.GetString("VectorCanNotBeEmpty", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The given work array is too small. Check work[0] for the corret size.. /// Looks up a localized string similar to The given work array is too small. Check work[0] for the corret size..
/// </summary> /// </summary>

15
src/Numerics/Properties/Resources.resx

@ -421,4 +421,19 @@
<data name="UserWorkBufferNotSupported" xml:space="preserve"> <data name="UserWorkBufferNotSupported" xml:space="preserve">
<value>User work buffers are not supported by this provider.</value> <value>User work buffers are not supported by this provider.</value>
</data> </data>
<data name="InvalidParameter" xml:space="preserve">
<value>An invalid parameter was passed to a native method.</value>
</data>
<data name="InvalidParameterWithNumber" xml:space="preserve">
<value>An invalid parameter was passed to a native method, parameter number : {0}</value>
</data>
<data name="MemoryAllocation" xml:space="preserve">
<value>Unable to allocate native memory.</value>
</data>
<data name="SingularUMatrix" xml:space="preserve">
<value>U is singular, and the inversion could not be completed.</value>
</data>
<data name="SingularUMatrixWithElement" xml:space="preserve">
<value>U is singular, and the inversion could not be completed. The {0}-th diagonal element of the factor U is zero.</value>
</data>
</root> </root>

477
src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex.cs

@ -76,8 +76,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, rows * columns), "matrix"); throw new ArgumentException(string.Format(Resources.ArrayTooSmall, rows * columns), "matrix");
} }
var work = new double[rows]; return SafeNativeMethods.z_matrix_norm((byte)norm, rows, columns, matrix);
return SafeNativeMethods.z_matrix_norm((byte)norm, rows, columns, matrix, work);
} }
/// <summary> /// <summary>
@ -274,7 +273,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
} }
SafeNativeMethods.z_lu_factor(order, data, ipiv); var info = SafeNativeMethods.z_lu_factor(order, data, ipiv);
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -296,77 +300,22 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
} }
var work = new Complex[order]; var info = SafeNativeMethods.z_lu_inverse(order, a);
SafeNativeMethods.z_lu_inverse(order, a, work, work.Length);
}
/// <summary> if (info == (int)MklError.MemoryAllocation)
/// Computes the inverse of a previously factored matrix.
/// </summary>
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
/// <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>
[SecuritySafeCritical]
public override void LUInverseFactored(Complex[] a, int order, int[] ipiv)
{
if (a == null)
{ {
throw new ArgumentNullException("a"); throw new MemoryAllocationException();
} }
if (ipiv == null) if (info < 0)
{ {
throw new ArgumentNullException("ipiv"); throw new InvalidParameterException(Math.Abs(info));
} }
if (a.Length != order*order) if (info > 0)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
}
if (ipiv.Length != order)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
}
var work = new Complex[order];
SafeNativeMethods.z_lu_inverse_factored(order, a, ipiv, work, order);
}
/// <summary>
/// Computes the inverse of matrix using LU factorization.
/// </summary>
/// <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>
/// <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>
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void LUInverse(Complex[] a, int order, Complex[] work)
{
if (a == null)
{
throw new ArgumentNullException("a");
}
if (a.Length != order*order)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
}
if (work == null)
{
throw new ArgumentNullException("work");
}
if (work.Length < order)
{ {
throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); throw new SingularUMatrixException(info);
} }
SafeNativeMethods.z_lu_inverse(order, a, work, work.Length);
} }
/// <summary> /// <summary>
@ -375,12 +324,9 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param> /// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param> /// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param> /// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks> /// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void LUInverseFactored(Complex[] a, int order, int[] ipiv, Complex[] work) public override void LUInverseFactored(Complex[] a, int order, int[] ipiv)
{ {
if (a == null) if (a == null)
{ {
@ -402,17 +348,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
} }
if (work == null) var info = SafeNativeMethods.z_lu_inverse_factored(order, a, ipiv);
{
throw new ArgumentNullException("work");
}
if (work.Length < order) if (info < 0)
{ {
throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); throw new InvalidParameterException(Math.Abs(info));
} }
SafeNativeMethods.z_lu_inverse_factored(order, a, ipiv, work, order); if (info > 0)
{
throw new SingularUMatrixException(info);
}
} }
/// <summary> /// <summary>
@ -446,7 +392,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.z_lu_solve(order, columnsOfB, a, b); var info = SafeNativeMethods.z_lu_solve(order, columnsOfB, a, b);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -491,7 +447,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.z_lu_solve_factored(order, columnsOfB, a, ipiv, b); var info = SafeNativeMethods.z_lu_solve_factored(order, columnsOfB, a, ipiv, b);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -521,6 +487,11 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
var info = SafeNativeMethods.z_cholesky_factor(order, a); var info = SafeNativeMethods.z_cholesky_factor(order, a);
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
if (info > 0) if (info > 0)
{ {
throw new ArgumentException(Resources.ArgumentMatrixPositiveDefinite); throw new ArgumentException(Resources.ArgumentMatrixPositiveDefinite);
@ -559,7 +530,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.z_cholesky_solve(orderA, columnsB, a, b); var info = SafeNativeMethods.z_cholesky_solve(orderA, columnsB, a, b);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -593,51 +574,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.z_cholesky_solve_factored(orderA, columnsB, a, b); var info = SafeNativeMethods.z_cholesky_solve_factored(orderA, columnsB, a, b);
}
/// <summary>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">On entry, it is the M by N A matrix to factor. On exit,
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void QRFactor(Complex[] r, int rowsR, int columnsR, Complex[] q, Complex[] tau)
{
if (r == null)
{
throw new ArgumentNullException("r");
}
if (q == null)
{
throw new ArgumentNullException("q");
}
if (r.Length != rowsR*columnsR)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r");
}
if (tau.Length < Math.Min(rowsR, columnsR))
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, "min(m,n)"), "tau");
}
if (q.Length != rowsR*rowsR) if (info < 0)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q"); throw new InvalidParameterException(Math.Abs(info));
} }
var work = new Complex[columnsR*Control.BlockSize];
SafeNativeMethods.z_qr_factor(rowsR, columnsR, r, tau, q, work, work.Length);
} }
/// <summary> /// <summary>
@ -647,16 +589,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// it is overwritten with the R matrix of the QR factorization. </param> /// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param> /// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param> /// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the /// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param> /// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information /// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param> /// to be used by the QR solve routine.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks> /// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRFactor(Complex[] r, int rowsR, int columnsR, Complex[] q, Complex[] tau, Complex[] work) public override void QRFactor(Complex[] r, int rowsR, int columnsR, Complex[] q, Complex[] tau)
{ {
if (r == null) if (r == null)
{ {
@ -668,11 +607,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("q"); throw new ArgumentNullException("q");
} }
if (work == null)
{
throw new ArgumentNullException("work");
}
if (r.Length != rowsR*columnsR) if (r.Length != rowsR*columnsR)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r");
@ -688,13 +622,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q");
} }
if (work.Length < columnsR*Control.BlockSize) var info = SafeNativeMethods.z_qr_factor(rowsR, columnsR, r, tau, q);
if (info < 0)
{ {
work[0] = columnsR*Control.BlockSize; throw new InvalidParameterException(Math.Abs(info));
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
SafeNativeMethods.z_qr_factor(rowsR, columnsR, r, tau, q, work, work.Length);
} }
/// <summary> /// <summary>
@ -737,66 +670,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r");
} }
var work = new Complex[columnsA * Control.BlockSize]; var info = SafeNativeMethods.z_qr_thin_factor(rowsA, columnsA, q, tau, r);
SafeNativeMethods.z_qr_thin_factor(rowsA, columnsA, q, tau, r, work, work.Length);
}
/// <summary> if (info < 0)
/// Computes the thin QR factorization of A where M &gt; N.
/// </summary>
/// <param name="q">On entry, it is the M by N A matrix to factor. On exit,
/// it is overwritten with the Q matrix of the QR factorization.</param>
/// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="r">On exit, A N by N matrix that holds the R matrix of the
/// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void ThinQRFactor(Complex[] q, int rowsA, int columnsA, Complex[] r, Complex[] tau, Complex[] work)
{
if (r == null)
{ {
throw new ArgumentNullException("r"); throw new InvalidParameterException(Math.Abs(info));
} }
if (q == null)
{
throw new ArgumentNullException("q");
}
if (work == null)
{
throw new ArgumentNullException("q");
}
if (q.Length != rowsA*columnsA)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "q");
}
if (tau.Length < Math.Min(rowsA, columnsA))
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, "min(m,n)"), "tau");
}
if (r.Length != columnsA*columnsA)
{
throw new ArgumentException(
string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r");
}
if (work.Length < columnsA*Control.BlockSize)
{
work[0] = columnsA*Control.BlockSize;
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
}
SafeNativeMethods.z_qr_thin_factor(rowsA, columnsA, q, tau, r, work, work.Length);
} }
/// <summary> /// <summary>
@ -812,27 +691,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// <remarks>Rows must be greater or equal to columns.</remarks> /// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRSolve(Complex[] a, int rows, int columns, Complex[] b, int columnsB, Complex[] x, QRMethod method = QRMethod.Full) public override void QRSolve(Complex[] a, int rows, int columns, Complex[] b, int columnsB, Complex[] x, QRMethod method = QRMethod.Full)
{
var work = new Complex[columns*Control.BlockSize];
QRSolve(a, rows, columns, b, columnsB, x, work, method);
}
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="a">The A matrix.</param>
/// <param name="rows">The number of rows in the A matrix.</param>
/// <param name="columns">The number of columns in the A matrix.</param>
/// <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>
/// <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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical]
public override void QRSolve(Complex[] a, int rows, int columns, Complex[] b, int columnsB, Complex[] x, Complex[] work, QRMethod method = QRMethod.Full)
{ {
if (a == null) if (a == null)
{ {
@ -849,22 +707,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("x"); throw new ArgumentNullException("x");
} }
if (work == null) if (a.Length != rows * columns)
{
throw new ArgumentNullException("work");
}
if (a.Length != rows*columns)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
} }
if (b.Length != rows*columnsB) if (b.Length != rows * columnsB)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
} }
if (x.Length != columns*columnsB) if (x.Length != columns * columnsB)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "x"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "x");
} }
@ -874,56 +727,40 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.RowsLessThanColumns); throw new ArgumentException(Resources.RowsLessThanColumns);
} }
if (work.Length < 1) var info = SafeNativeMethods.z_qr_solve(rows, columns, columnsB, a, b, x);
if (info == (int)MklError.MemoryAllocation)
{ {
work[0] = rows*Control.BlockSize; throw new MemoryAllocationException();
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
SafeNativeMethods.z_qr_solve(rows, columns, columnsB, a, b, x, work, work.Length); if (info < 0)
} {
throw new InvalidParameterException(Math.Abs(info));
}
/// <summary> if (info > 0)
/// Solves A*X=B for X using a previously QR factored matrix. {
/// </summary> throw new ArgumentException(Resources.ArgumentMatrixNotRankDeficient, "a");
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[],Complex[])"/>.</param> }
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[],Complex[])"/>. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="tau">Contains additional information on Q. Only used for the native solver
/// and can be <c>null</c> for the managed provider.</param>
/// <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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical]
public override void QRSolveFactored(Complex[] q, Complex[] r, int rowsR, int columnsR, Complex[] tau, Complex[] b, int columnsB, Complex[] x, QRMethod method = QRMethod.Full)
{
var work = new Complex[columnsR*Control.BlockSize];
QRSolveFactored(q, r, rowsR, columnsR, tau, b, columnsB, x, work, method);
} }
/// <summary> /// <summary>
/// Solves A*X=B for X using a previously QR factored matrix. /// Solves A*X=B for X using a previously QR factored matrix.
/// </summary> /// </summary>
/// <param name="q">The Q matrix obtained by QR factor. This is only used for the managed provider and can be /// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[],Complex[])"/>.</param>
/// <c>null</c> for the native provider. The native provider uses the Q portion stored in the R matrix.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[],Complex[])"/>. </param> /// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex[],int,int,Complex[],Complex[])"/>. </param>
/// <param name="rowsA">The number of rows in the A matrix.</param> /// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param> /// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="tau">Contains additional information on Q. Only used for the native solver /// <param name="tau">Contains additional information on Q. Only used for the native solver
/// and can be <c>null</c> for the managed provider.</param> /// and can be <c>null</c> for the managed provider.</param>
/// <param name="b">On entry the B matrix; on exit the X matrix.</param> /// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param> /// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param> /// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array - only used in the native provider. 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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param> /// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks> /// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRSolveFactored(Complex[] q, Complex[] r, int rowsA, int columnsA, Complex[] tau, Complex[] b, int columnsB, Complex[] x, Complex[] work, QRMethod method = QRMethod.Full) public override void QRSolveFactored(Complex[] q, Complex[] r, int rowsA, int columnsA, Complex[] tau, Complex[] b, int columnsB, Complex[] x, QRMethod method = QRMethod.Full)
{ {
if (r == null) if (r == null)
{ {
@ -945,11 +782,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("q"); throw new ArgumentNullException("q");
} }
if (work == null)
{
throw new ArgumentNullException("work");
}
int rowsQ, columnsQ, rowsR, columnsR; int rowsQ, columnsQ, rowsR, columnsR;
if (method == QRMethod.Full) if (method == QRMethod.Full)
{ {
@ -962,35 +794,39 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
columnsQ = rowsR = columnsR = columnsA; columnsQ = rowsR = columnsR = columnsA;
} }
if (r.Length != rowsR*columnsR) if (r.Length != rowsR * columnsR)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsR*columnsR), "r");
}
if (q.Length != rowsQ*columnsQ)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsQ*columnsQ), "q"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsR * columnsR), "r");
} }
if (b.Length != rowsA*columnsB) if (q.Length != rowsQ * columnsQ)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsA*columnsB), "b"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsQ * columnsQ), "q");
} }
if (x.Length != columnsA*columnsB) if (b.Length != rowsA * columnsB)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, columnsA*columnsB), "x"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsA * columnsB), "b");
} }
if (work.Length < 1) if (x.Length != columnsA * columnsB)
{ {
work[0] = rowsA*Control.BlockSize; throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, columnsA * columnsB), "x");
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
if (method == QRMethod.Full) if (method == QRMethod.Full)
{ {
SafeNativeMethods.z_qr_solve_factored(rowsA, columnsA, columnsB, r, b, tau, x, work, work.Length); var info = SafeNativeMethods.z_qr_solve_factored(rowsA, columnsA, columnsB, r, b, tau, x);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
else else
{ {
@ -1000,61 +836,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
} }
} }
/// <summary>
/// Computes the singular value decomposition of A.
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is <c>true</c>, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
[SecuritySafeCritical]
public override void SingularValueDecomposition(bool computeVectors, Complex[] a, int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt)
{
if (a == null)
{
throw new ArgumentNullException("a");
}
if (s == null)
{
throw new ArgumentNullException("s");
}
if (u == null)
{
throw new ArgumentNullException("u");
}
if (vt == null)
{
throw new ArgumentNullException("vt");
}
if (u.Length != rowsA*rowsA)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "u");
}
if (vt.Length != columnsA*columnsA)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "vt");
}
if (s.Length != Math.Min(rowsA, columnsA))
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "s");
}
var work = new Complex[(2*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)];
SingularValueDecomposition(computeVectors, a, rowsA, columnsA, s, u, vt, work);
}
/// <summary> /// <summary>
/// Solves A*X=B for X using the singular value decomposition of A. /// Solves A*X=B for X using the singular value decomposition of A.
/// </summary> /// </summary>
@ -1091,14 +872,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
} }
var work = new Complex[(2*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)];
var s = new Complex[Math.Min(rowsA, columnsA)]; var s = new Complex[Math.Min(rowsA, columnsA)];
var u = new Complex[rowsA*rowsA]; var u = new Complex[rowsA*rowsA];
var vt = new Complex[columnsA*columnsA]; var vt = new Complex[columnsA*columnsA];
var clone = new Complex[a.Length]; var clone = new Complex[a.Length];
a.Copy(clone); a.Copy(clone);
SingularValueDecomposition(true, clone, rowsA, columnsA, s, u, vt, work); SingularValueDecomposition(true, clone, rowsA, columnsA, s, u, vt);
SvdSolveFactored(rowsA, columnsA, s, u, vt, b, columnsB, x); SvdSolveFactored(rowsA, columnsA, s, u, vt, b, columnsB, x);
} }
@ -1114,12 +894,9 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// singular vectors.</param> /// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed /// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed
/// right singular vectors.</param> /// right singular vectors.</param>
/// <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>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks> /// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void SingularValueDecomposition(bool computeVectors, Complex[] a, int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt, Complex[] work) public override void SingularValueDecomposition(bool computeVectors, Complex[] a, int rowsA, int columnsA, Complex[] s, Complex[] u, Complex[] vt)
{ {
if (a == null) if (a == null)
{ {
@ -1141,11 +918,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("vt"); throw new ArgumentNullException("vt");
} }
if (work == null)
{
throw new ArgumentNullException("work");
}
if (u.Length != rowsA*rowsA) if (u.Length != rowsA*rowsA)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "u"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "u");
@ -1161,18 +933,19 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "s"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "s");
} }
if (work.Length == 0) var info = SafeNativeMethods.z_svd_factor(computeVectors, rowsA, columnsA, a, s, u, vt);
if (info == (int) MklError.MemoryAllocation)
{ {
throw new ArgumentException(Resources.ArgumentSingleDimensionArray, "work"); throw new MemoryAllocationException();
} }
if (work.Length < (2*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)) if (info < 0)
{ {
work[0] = (2*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA); throw new InvalidParameterException(Math.Abs(info));
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
if (SafeNativeMethods.z_svd_factor(computeVectors, rowsA, columnsA, a, s, u, vt, work, work.Length) > 0) if (info > 0)
{ {
throw new NonConvergenceException(); throw new NonConvergenceException();
} }
@ -1369,7 +1142,19 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(String.Format(Resources.ArgumentArrayWrongLength, order * order), "matrixD"); throw new ArgumentException(String.Format(Resources.ArgumentArrayWrongLength, order * order), "matrixD");
} }
if (SafeNativeMethods.z_eigen(isSymmetric, order, matrix, matrixEv, vectorEv, matrixD) > 0) var info = SafeNativeMethods.z_eigen(isSymmetric, order, matrix, matrixEv, vectorEv, matrixD);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
if (info > 0)
{ {
throw new NonConvergenceException(); throw new NonConvergenceException();
} }

478
src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex32.cs

@ -76,8 +76,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, rows * columns), "matrix"); throw new ArgumentException(string.Format(Resources.ArrayTooSmall, rows * columns), "matrix");
} }
var work = new float[rows]; return SafeNativeMethods.c_matrix_norm((byte)norm, rows, columns, matrix);
return SafeNativeMethods.c_matrix_norm((byte)norm, rows, columns, matrix, work);
} }
/// <summary> /// <summary>
@ -274,7 +273,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
} }
SafeNativeMethods.c_lu_factor(order, data, ipiv); var info = SafeNativeMethods.c_lu_factor(order, data, ipiv);
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -296,77 +300,22 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
} }
var work = new Complex32[order]; var info = SafeNativeMethods.c_lu_inverse(order, a);
SafeNativeMethods.c_lu_inverse(order, a, work, work.Length);
}
/// <summary>
/// Computes the inverse of a previously factored matrix.
/// </summary>
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
/// <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>
[SecuritySafeCritical]
public override void LUInverseFactored(Complex32[] a, int order, int[] ipiv)
{
if (a == null)
{
throw new ArgumentNullException("a");
}
if (ipiv == null)
{
throw new ArgumentNullException("ipiv");
}
if (a.Length != order*order) if (info == (int)MklError.MemoryAllocation)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); throw new MemoryAllocationException();
} }
if (ipiv.Length != order) if (info < 0)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); throw new InvalidParameterException(Math.Abs(info));
} }
var work = new Complex32[order]; if (info > 0)
SafeNativeMethods.c_lu_inverse_factored(order, a, ipiv, work, order);
}
/// <summary>
/// Computes the inverse of matrix using LU factorization.
/// </summary>
/// <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>
/// <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>
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void LUInverse(Complex32[] a, int order, Complex32[] work)
{
if (a == null)
{
throw new ArgumentNullException("a");
}
if (a.Length != order*order)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
}
if (work == null)
{
throw new ArgumentNullException("work");
}
if (work.Length < order)
{ {
throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); throw new SingularUMatrixException(info);
} }
SafeNativeMethods.c_lu_inverse(order, a, work, work.Length);
} }
/// <summary> /// <summary>
@ -375,12 +324,9 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param> /// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param> /// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param> /// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks> /// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void LUInverseFactored(Complex32[] a, int order, int[] ipiv, Complex32[] work) public override void LUInverseFactored(Complex32[] a, int order, int[] ipiv)
{ {
if (a == null) if (a == null)
{ {
@ -402,17 +348,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
} }
if (work == null) var info = SafeNativeMethods.c_lu_inverse_factored(order, a, ipiv);
{
throw new ArgumentNullException("work");
}
if (work.Length < order) if (info < 0)
{ {
throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); throw new InvalidParameterException(Math.Abs(info));
} }
SafeNativeMethods.c_lu_inverse_factored(order, a, ipiv, work, order); if (info > 0)
{
throw new SingularUMatrixException(info);
}
} }
/// <summary> /// <summary>
@ -446,7 +392,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.c_lu_solve(order, columnsOfB, a, b); var info = SafeNativeMethods.c_lu_solve(order, columnsOfB, a, b);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -491,7 +447,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.c_lu_solve_factored(order, columnsOfB, a, ipiv, b); var info = SafeNativeMethods.c_lu_solve_factored(order, columnsOfB, a, ipiv, b);
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -521,6 +482,11 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
var info = SafeNativeMethods.c_cholesky_factor(order, a); var info = SafeNativeMethods.c_cholesky_factor(order, a);
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
if (info > 0) if (info > 0)
{ {
throw new ArgumentException(Resources.ArgumentMatrixPositiveDefinite); throw new ArgumentException(Resources.ArgumentMatrixPositiveDefinite);
@ -559,7 +525,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.c_cholesky_solve(orderA, columnsB, a, b); var info = SafeNativeMethods.c_cholesky_solve(orderA, columnsB, a, b);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -593,51 +569,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.c_cholesky_solve_factored(orderA, columnsB, a, b); var info = SafeNativeMethods.c_cholesky_solve_factored(orderA, columnsB, a, b);
}
/// <summary>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">On entry, it is the M by N A matrix to factor. On exit,
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void QRFactor(Complex32[] r, int rowsR, int columnsR, Complex32[] q, Complex32[] tau)
{
if (r == null)
{
throw new ArgumentNullException("r");
}
if (q == null)
{
throw new ArgumentNullException("q");
}
if (r.Length != rowsR*columnsR) if (info < 0)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r"); throw new InvalidParameterException(Math.Abs(info));
} }
if (tau.Length < Math.Min(rowsR, columnsR))
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, "min(m,n)"), "tau");
}
if (q.Length != rowsR*rowsR)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q");
}
var work = new Complex32[columnsR*Control.BlockSize];
SafeNativeMethods.c_qr_factor(rowsR, columnsR, r, tau, q, work, work.Length);
} }
/// <summary> /// <summary>
@ -647,16 +584,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// it is overwritten with the R matrix of the QR factorization. </param> /// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param> /// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param> /// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the /// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param> /// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information /// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param> /// to be used by the QR solve routine.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks> /// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRFactor(Complex32[] r, int rowsR, int columnsR, Complex32[] q, Complex32[] tau, Complex32[] work) public override void QRFactor(Complex32[] r, int rowsR, int columnsR, Complex32[] q, Complex32[] tau)
{ {
if (r == null) if (r == null)
{ {
@ -668,11 +602,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("q"); throw new ArgumentNullException("q");
} }
if (work == null)
{
throw new ArgumentNullException("work");
}
if (r.Length != rowsR*columnsR) if (r.Length != rowsR*columnsR)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r");
@ -688,13 +617,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q");
} }
if (work.Length < columnsR*Control.BlockSize) var info = SafeNativeMethods.c_qr_factor(rowsR, columnsR, r, tau, q);
if (info < 0)
{ {
work[0] = columnsR*Control.BlockSize; throw new InvalidParameterException(Math.Abs(info));
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
SafeNativeMethods.c_qr_factor(rowsR, columnsR, r, tau, q, work, work.Length);
} }
/// <summary> /// <summary>
@ -737,66 +665,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r");
} }
var work = new Complex32[columnsA * Control.BlockSize]; var info = SafeNativeMethods.c_qr_thin_factor(rowsA, columnsA, q, tau, r);
SafeNativeMethods.c_qr_thin_factor(rowsA, columnsA, q, tau, r, work, work.Length);
}
/// <summary>
/// Computes the thin QR factorization of A where M &gt; N.
/// </summary>
/// <param name="q">On entry, it is the M by N A matrix to factor. On exit,
/// it is overwritten with the Q matrix of the QR factorization.</param>
/// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="r">On exit, A N by N matrix that holds the R matrix of the
/// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void ThinQRFactor(Complex32[] q, int rowsA, int columnsA, Complex32[] r, Complex32[] tau, Complex32[] work)
{
if (r == null)
{
throw new ArgumentNullException("r");
}
if (q == null)
{
throw new ArgumentNullException("q");
}
if (work == null)
{
throw new ArgumentNullException("q");
}
if (q.Length != rowsA*columnsA)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "q");
}
if (tau.Length < Math.Min(rowsA, columnsA))
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, "min(m,n)"), "tau");
}
if (r.Length != columnsA*columnsA)
{
throw new ArgumentException(
string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r");
}
if (work.Length < columnsA*Control.BlockSize) if (info < 0)
{ {
work[0] = columnsA*Control.BlockSize; throw new InvalidParameterException(Math.Abs(info));
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
SafeNativeMethods.c_qr_thin_factor(rowsA, columnsA, q, tau, r, work, work.Length);
} }
/// <summary> /// <summary>
@ -812,27 +686,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// <remarks>Rows must be greater or equal to columns.</remarks> /// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRSolve(Complex32[] a, int rows, int columns, Complex32[] b, int columnsB, Complex32[] x, QRMethod method = QRMethod.Full) public override void QRSolve(Complex32[] a, int rows, int columns, Complex32[] b, int columnsB, Complex32[] x, QRMethod method = QRMethod.Full)
{
var work = new Complex32[columns*Control.BlockSize];
QRSolve(a, rows, columns, b, columnsB, x, work, method);
}
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="a">The A matrix.</param>
/// <param name="rows">The number of rows in the A matrix.</param>
/// <param name="columns">The number of columns in the A matrix.</param>
/// <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>
/// <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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical]
public override void QRSolve(Complex32[] a, int rows, int columns, Complex32[] b, int columnsB, Complex32[] x, Complex32[] work, QRMethod method = QRMethod.Full)
{ {
if (a == null) if (a == null)
{ {
@ -849,22 +702,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("x"); throw new ArgumentNullException("x");
} }
if (work == null) if (a.Length != rows * columns)
{
throw new ArgumentNullException("work");
}
if (a.Length != rows*columns)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
} }
if (b.Length != rows*columnsB) if (b.Length != rows * columnsB)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
} }
if (x.Length != columns*columnsB) if (x.Length != columns * columnsB)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "x"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "x");
} }
@ -874,56 +722,40 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.RowsLessThanColumns); throw new ArgumentException(Resources.RowsLessThanColumns);
} }
if (work.Length < 1) var info = SafeNativeMethods.c_qr_solve(rows, columns, columnsB, a, b, x);
if (info == (int)MklError.MemoryAllocation)
{ {
work[0] = rows*Control.BlockSize; throw new MemoryAllocationException();
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
SafeNativeMethods.c_qr_solve(rows, columns, columnsB, a, b, x, work, work.Length); if (info < 0)
} {
throw new InvalidParameterException(Math.Abs(info));
}
/// <summary> if (info > 0)
/// Solves A*X=B for X using a previously QR factored matrix. {
/// </summary> throw new ArgumentException(Resources.ArgumentMatrixNotRankDeficient, "a");
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex32[],int,int,Complex32[],Complex32[])"/>.</param> }
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex32[],int,int,Complex32[],Complex32[])"/>. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="tau">Contains additional information on Q. Only used for the native solver
/// and can be <c>null</c> for the managed provider.</param>
/// <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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical]
public override void QRSolveFactored(Complex32[] q, Complex32[] r, int rowsR, int columnsR, Complex32[] tau, Complex32[] b, int columnsB, Complex32[] x, QRMethod method = QRMethod.Full)
{
var work = new Complex32[columnsR*Control.BlockSize];
QRSolveFactored(q, r, rowsR, columnsR, tau, b, columnsB, x, work, method);
} }
/// <summary> /// <summary>
/// Solves A*X=B for X using a previously QR factored matrix. /// Solves A*X=B for X using a previously QR factored matrix.
/// </summary> /// </summary>
/// <param name="q">The Q matrix obtained by QR factor. This is only used for the managed provider and can be /// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(Complex32[],int,int,Complex32[],Complex32[])"/>.</param>
/// <c>null</c> for the native provider. The native provider uses the Q portion stored in the R matrix.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex32[],int,int,Complex32[],Complex32[])"/>. </param> /// <param name="r">The R matrix obtained by calling <see cref="QRFactor(Complex32[],int,int,Complex32[],Complex32[])"/>. </param>
/// <param name="rowsA">The number of rows in the A matrix.</param> /// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param> /// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="tau">Contains additional information on Q. Only used for the native solver /// <param name="tau">Contains additional information on Q. Only used for the native solver
/// and can be <c>null</c> for the managed provider.</param> /// and can be <c>null</c> for the managed provider.</param>
/// <param name="b">On entry the B matrix; on exit the X matrix.</param> /// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param> /// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param> /// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array - only used in the native provider. 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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param> /// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks> /// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRSolveFactored(Complex32[] q, Complex32[] r, int rowsA, int columnsA, Complex32[] tau, Complex32[] b, int columnsB, Complex32[] x, Complex32[] work, QRMethod method = QRMethod.Full) public override void QRSolveFactored(Complex32[] q, Complex32[] r, int rowsA, int columnsA, Complex32[] tau, Complex32[] b, int columnsB, Complex32[] x, QRMethod method = QRMethod.Full)
{ {
if (r == null) if (r == null)
{ {
@ -945,11 +777,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("q"); throw new ArgumentNullException("q");
} }
if (work == null)
{
throw new ArgumentNullException("work");
}
int rowsQ, columnsQ, rowsR, columnsR; int rowsQ, columnsQ, rowsR, columnsR;
if (method == QRMethod.Full) if (method == QRMethod.Full)
{ {
@ -962,35 +789,39 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
columnsQ = rowsR = columnsR = columnsA; columnsQ = rowsR = columnsR = columnsA;
} }
if (r.Length != rowsR*columnsR) if (r.Length != rowsR * columnsR)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsR*columnsR), "r");
}
if (q.Length != rowsQ*columnsQ)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsQ*columnsQ), "q"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsR * columnsR), "r");
} }
if (b.Length != rowsA*columnsB) if (q.Length != rowsQ * columnsQ)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsA*columnsB), "b"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsQ * columnsQ), "q");
} }
if (x.Length != columnsA*columnsB) if (b.Length != rowsA * columnsB)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, columnsA*columnsB), "x"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsA * columnsB), "b");
} }
if (work.Length < 1) if (x.Length != columnsA * columnsB)
{ {
work[0] = rowsA*Control.BlockSize; throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, columnsA * columnsB), "x");
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
if (method == QRMethod.Full) if (method == QRMethod.Full)
{ {
SafeNativeMethods.c_qr_solve_factored(rowsA, columnsA, columnsB, r, b, tau, x, work, work.Length); var info = SafeNativeMethods.c_qr_solve_factored(rowsA, columnsA, columnsB, r, b, tau, x);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
else else
{ {
@ -1000,61 +831,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
} }
} }
/// <summary>
/// Computes the singular value decomposition of A.
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is <c>true</c>, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
[SecuritySafeCritical]
public override void SingularValueDecomposition(bool computeVectors, Complex32[] a, int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt)
{
if (a == null)
{
throw new ArgumentNullException("a");
}
if (s == null)
{
throw new ArgumentNullException("s");
}
if (u == null)
{
throw new ArgumentNullException("u");
}
if (vt == null)
{
throw new ArgumentNullException("vt");
}
if (u.Length != rowsA*rowsA)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "u");
}
if (vt.Length != columnsA*columnsA)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "vt");
}
if (s.Length != Math.Min(rowsA, columnsA))
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "s");
}
var work = new Complex32[(2*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)];
SingularValueDecomposition(computeVectors, a, rowsA, columnsA, s, u, vt, work);
}
/// <summary> /// <summary>
/// Solves A*X=B for X using the singular value decomposition of A. /// Solves A*X=B for X using the singular value decomposition of A.
/// </summary> /// </summary>
@ -1091,14 +867,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
} }
var work = new Complex32[(2*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)];
var s = new Complex32[Math.Min(rowsA, columnsA)]; var s = new Complex32[Math.Min(rowsA, columnsA)];
var u = new Complex32[rowsA*rowsA]; var u = new Complex32[rowsA*rowsA];
var vt = new Complex32[columnsA*columnsA]; var vt = new Complex32[columnsA*columnsA];
var clone = new Complex32[a.Length]; var clone = new Complex32[a.Length];
a.Copy(clone); a.Copy(clone);
SingularValueDecomposition(true, clone, rowsA, columnsA, s, u, vt, work); SingularValueDecomposition(true, clone, rowsA, columnsA, s, u, vt);
SvdSolveFactored(rowsA, columnsA, s, u, vt, b, columnsB, x); SvdSolveFactored(rowsA, columnsA, s, u, vt, b, columnsB, x);
} }
@ -1114,12 +889,9 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// singular vectors.</param> /// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed /// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed
/// right singular vectors.</param> /// right singular vectors.</param>
/// <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>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks> /// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void SingularValueDecomposition(bool computeVectors, Complex32[] a, int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt, Complex32[] work) public override void SingularValueDecomposition(bool computeVectors, Complex32[] a, int rowsA, int columnsA, Complex32[] s, Complex32[] u, Complex32[] vt)
{ {
if (a == null) if (a == null)
{ {
@ -1141,17 +913,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("vt"); throw new ArgumentNullException("vt");
} }
if (work == null) if (u.Length != rowsA * rowsA)
{
throw new ArgumentNullException("work");
}
if (u.Length != rowsA*rowsA)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "u"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "u");
} }
if (vt.Length != columnsA*columnsA) if (vt.Length != columnsA * columnsA)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "vt"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "vt");
} }
@ -1161,18 +928,19 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "s"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "s");
} }
if (work.Length == 0) var info = SafeNativeMethods.c_svd_factor(computeVectors, rowsA, columnsA, a, s, u, vt);
if (info == (int)MklError.MemoryAllocation)
{ {
throw new ArgumentException(Resources.ArgumentSingleDimensionArray, "work"); throw new MemoryAllocationException();
} }
if (work.Length < (2*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)) if (info < 0)
{ {
work[0] = (2*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA); throw new InvalidParameterException(Math.Abs(info));
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
if (SafeNativeMethods.c_svd_factor(computeVectors, rowsA, columnsA, a, s, u, vt, work, work.Length) > 0) if (info > 0)
{ {
throw new NonConvergenceException(); throw new NonConvergenceException();
} }
@ -1366,10 +1134,22 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
if (matrixD.Length != order * order) if (matrixD.Length != order * order)
{ {
throw new ArgumentException(String.Format(Resources.ArgumentArrayWrongLength, order * order), "matrixD"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, order * order), "matrixD");
} }
if (SafeNativeMethods.c_eigen(isSymmetric, order, matrix, matrixEv, vectorEv, matrixD) > 0) var info = SafeNativeMethods.c_eigen(isSymmetric, order, matrix, matrixEv, vectorEv, matrixD);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
if (info > 0)
{ {
throw new NonConvergenceException(); throw new NonConvergenceException();
} }

481
src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Double.cs

@ -76,8 +76,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, rows * columns), "matrix"); throw new ArgumentException(string.Format(Resources.ArrayTooSmall, rows * columns), "matrix");
} }
var work = new double[rows]; return SafeNativeMethods.d_matrix_norm((byte)norm, rows, columns, matrix);
return SafeNativeMethods.d_matrix_norm((byte)norm, rows, columns, matrix, work);
} }
/// <summary> /// <summary>
@ -274,7 +273,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
} }
SafeNativeMethods.d_lu_factor(order, data, ipiv); var info = SafeNativeMethods.d_lu_factor(order, data, ipiv);
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -296,77 +300,22 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
} }
var work = new double[order]; var info = SafeNativeMethods.d_lu_inverse(order, a);
SafeNativeMethods.d_lu_inverse(order, a, work, work.Length);
}
/// <summary> if (info == (int)MklError.MemoryAllocation)
/// Computes the inverse of a previously factored matrix.
/// </summary>
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
/// <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>
[SecuritySafeCritical]
public override void LUInverseFactored(double[] a, int order, int[] ipiv)
{
if (a == null)
{ {
throw new ArgumentNullException("a"); throw new MemoryAllocationException();
} }
if (ipiv == null) if (info < 0)
{ {
throw new ArgumentNullException("ipiv"); throw new InvalidParameterException(Math.Abs(info));
} }
if (a.Length != order*order) if (info > 0)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
}
if (ipiv.Length != order)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
}
var work = new double[order];
SafeNativeMethods.d_lu_inverse_factored(order, a, ipiv, work, order);
}
/// <summary>
/// Computes the inverse of matrix using LU factorization.
/// </summary>
/// <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>
/// <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>
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void LUInverse(double[] a, int order, double[] work)
{
if (a == null)
{
throw new ArgumentNullException("a");
}
if (a.Length != order*order)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
}
if (work == null)
{
throw new ArgumentNullException("work");
}
if (work.Length < order)
{ {
throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); throw new SingularUMatrixException(info);
} }
SafeNativeMethods.d_lu_inverse(order, a, work, work.Length);
} }
/// <summary> /// <summary>
@ -375,12 +324,9 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param> /// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param> /// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param> /// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks> /// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void LUInverseFactored(double[] a, int order, int[] ipiv, double[] work) public override void LUInverseFactored(double[] a, int order, int[] ipiv)
{ {
if (a == null) if (a == null)
{ {
@ -402,17 +348,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
} }
if (work == null) var info = SafeNativeMethods.d_lu_inverse_factored(order, a, ipiv);
{
throw new ArgumentNullException("work");
}
if (work.Length < order) if (info < 0)
{ {
throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); throw new InvalidParameterException(Math.Abs(info));
} }
SafeNativeMethods.d_lu_inverse_factored(order, a, ipiv, work, order); if (info > 0)
{
throw new SingularUMatrixException(info);
}
} }
/// <summary> /// <summary>
@ -446,7 +392,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.d_lu_solve(order, columnsOfB, a, b); var info = SafeNativeMethods.d_lu_solve(order, columnsOfB, a, b);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -491,7 +447,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.d_lu_solve_factored(order, columnsOfB, a, ipiv, b); var info = SafeNativeMethods.d_lu_solve_factored(order, columnsOfB, a, ipiv, b);
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -521,6 +482,16 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
var info = SafeNativeMethods.d_cholesky_factor(order, a); var info = SafeNativeMethods.d_cholesky_factor(order, a);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
if (info > 0) if (info > 0)
{ {
throw new ArgumentException(Resources.ArgumentMatrixPositiveDefinite); throw new ArgumentException(Resources.ArgumentMatrixPositiveDefinite);
@ -559,7 +530,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.d_cholesky_solve(orderA, columnsB, a, b); var info = SafeNativeMethods.d_cholesky_solve(orderA, columnsB, a, b);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -593,51 +574,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.d_cholesky_solve_factored(orderA, columnsB, a, b); var info = SafeNativeMethods.d_cholesky_solve_factored(orderA, columnsB, a, b);
}
/// <summary>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">On entry, it is the M by N A matrix to factor. On exit,
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void QRFactor(double[] r, int rowsR, int columnsR, double[] q, double[] tau)
{
if (r == null)
{
throw new ArgumentNullException("r");
}
if (q == null)
{
throw new ArgumentNullException("q");
}
if (r.Length != rowsR*columnsR)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r");
}
if (tau.Length < Math.Min(rowsR, columnsR))
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, "min(m,n)"), "tau");
}
if (q.Length != rowsR*rowsR) if (info < 0)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q"); throw new InvalidParameterException(Math.Abs(info));
} }
var work = new double[columnsR*Control.BlockSize];
SafeNativeMethods.d_qr_factor(rowsR, columnsR, r, tau, q, work, work.Length);
} }
/// <summary> /// <summary>
@ -647,16 +589,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// it is overwritten with the R matrix of the QR factorization. </param> /// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param> /// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param> /// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the /// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param> /// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information /// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param> /// to be used by the QR solve routine.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks> /// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRFactor(double[] r, int rowsR, int columnsR, double[] q, double[] tau, double[] work) public override void QRFactor(double[] r, int rowsR, int columnsR, double[] q, double[] tau)
{ {
if (r == null) if (r == null)
{ {
@ -668,11 +607,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("q"); throw new ArgumentNullException("q");
} }
if (work == null)
{
throw new ArgumentNullException("work");
}
if (r.Length != rowsR*columnsR) if (r.Length != rowsR*columnsR)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r");
@ -688,13 +622,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q");
} }
if (work.Length < columnsR*Control.BlockSize) var info = SafeNativeMethods.d_qr_factor(rowsR, columnsR, r, tau, q);
if (info < 0)
{ {
work[0] = columnsR*Control.BlockSize; throw new InvalidParameterException(Math.Abs(info));
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
SafeNativeMethods.d_qr_factor(rowsR, columnsR, r, tau, q, work, work.Length);
} }
/// <summary> /// <summary>
@ -737,66 +670,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r");
} }
var work = new double[columnsA*Control.BlockSize]; var info = SafeNativeMethods.d_qr_thin_factor(rowsA, columnsA, q, tau, r);
SafeNativeMethods.d_qr_thin_factor(rowsA, columnsA, q, tau, r, work, work.Length);
}
/// <summary> if (info < 0)
/// Computes the thin QR factorization of A where M &gt; N.
/// </summary>
/// <param name="q">On entry, it is the M by N A matrix to factor. On exit,
/// it is overwritten with the Q matrix of the QR factorization.</param>
/// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="r">On exit, A N by N matrix that holds the R matrix of the
/// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void ThinQRFactor(double[] q, int rowsA, int columnsA, double[] r, double[] tau, double[] work)
{
if (r == null)
{ {
throw new ArgumentNullException("r"); throw new InvalidParameterException(Math.Abs(info));
} }
if (q == null)
{
throw new ArgumentNullException("q");
}
if (work == null)
{
throw new ArgumentNullException("q");
}
if (q.Length != rowsA*columnsA)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "q");
}
if (tau.Length < Math.Min(rowsA, columnsA))
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, "min(m,n)"), "tau");
}
if (r.Length != columnsA*columnsA)
{
throw new ArgumentException(
string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r");
}
if (work.Length < columnsA*Control.BlockSize)
{
work[0] = columnsA*Control.BlockSize;
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
}
SafeNativeMethods.d_qr_thin_factor(rowsA, columnsA, q, tau, r, work, work.Length);
} }
/// <summary> /// <summary>
@ -812,27 +691,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// <remarks>Rows must be greater or equal to columns.</remarks> /// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRSolve(double[] a, int rows, int columns, double[] b, int columnsB, double[] x, QRMethod method = QRMethod.Full) public override void QRSolve(double[] a, int rows, int columns, double[] b, int columnsB, double[] x, QRMethod method = QRMethod.Full)
{
var work = new double[columns*Control.BlockSize];
QRSolve(a, rows, columns, b, columnsB, x, work, method);
}
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="a">The A matrix.</param>
/// <param name="rows">The number of rows in the A matrix.</param>
/// <param name="columns">The number of columns in the A matrix.</param>
/// <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>
/// <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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical]
public override void QRSolve(double[] a, int rows, int columns, double[] b, int columnsB, double[] x, double[] work, QRMethod method = QRMethod.Full)
{ {
if (a == null) if (a == null)
{ {
@ -849,22 +707,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("x"); throw new ArgumentNullException("x");
} }
if (work == null) if (a.Length != rows * columns)
{
throw new ArgumentNullException("work");
}
if (a.Length != rows*columns)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
} }
if (b.Length != rows*columnsB) if (b.Length != rows * columnsB)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
} }
if (x.Length != columns*columnsB) if (x.Length != columns * columnsB)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "x"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "x");
} }
@ -874,56 +727,40 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.RowsLessThanColumns); throw new ArgumentException(Resources.RowsLessThanColumns);
} }
if (work.Length < 1) var info = SafeNativeMethods.d_qr_solve(rows, columns, columnsB, a, b, x);
if (info == (int)MklError.MemoryAllocation)
{ {
work[0] = rows*Control.BlockSize; throw new MemoryAllocationException();
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
SafeNativeMethods.d_qr_solve(rows, columns, columnsB, a, b, x, work, work.Length); if (info < 0)
} {
throw new InvalidParameterException(Math.Abs(info));
}
/// <summary> if (info > 0)
/// Solves A*X=B for X using a previously QR factored matrix. {
/// </summary> throw new ArgumentException(Resources.ArgumentMatrixNotRankDeficient, "a");
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(double[],int,int,double[],double[])"/>.</param> }
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(double[],int,int,double[],double[])"/>. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="tau">Contains additional information on Q. Only used for the native solver
/// and can be <c>null</c> for the managed provider.</param>
/// <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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical]
public override void QRSolveFactored(double[] q, double[] r, int rowsR, int columnsR, double[] tau, double[] b, int columnsB, double[] x, QRMethod method = QRMethod.Full)
{
var work = new double[columnsR*Control.BlockSize];
QRSolveFactored(q, r, rowsR, columnsR, tau, b, columnsB, x, work, method);
} }
/// <summary> /// <summary>
/// Solves A*X=B for X using a previously QR factored matrix. /// Solves A*X=B for X using a previously QR factored matrix.
/// </summary> /// </summary>
/// <param name="q">The Q matrix obtained by QR factor. This is only used for the managed provider and can be /// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(double[],int,int,double[],double[])"/>.</param>
/// <c>null</c> for the native provider. The native provider uses the Q portion stored in the R matrix.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(double[],int,int,double[],double[])"/>. </param> /// <param name="r">The R matrix obtained by calling <see cref="QRFactor(double[],int,int,double[],double[])"/>. </param>
/// <param name="rowsA">The number of rows in the A matrix.</param> /// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param> /// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="tau">Contains additional information on Q. Only used for the native solver /// <param name="tau">Contains additional information on Q. Only used for the native solver
/// and can be <c>null</c> for the managed provider.</param> /// and can be <c>null</c> for the managed provider.</param>
/// <param name="b">On entry the B matrix; on exit the X matrix.</param> /// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param> /// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param> /// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array - only used in the native provider. 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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param> /// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks> /// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRSolveFactored(double[] q, double[] r, int rowsA, int columnsA, double[] tau, double[] b, int columnsB, double[] x, double[] work, QRMethod method = QRMethod.Full) public override void QRSolveFactored(double[] q, double[] r, int rowsA, int columnsA, double[] tau, double[] b, int columnsB, double[] x, QRMethod method = QRMethod.Full)
{ {
if (r == null) if (r == null)
{ {
@ -945,11 +782,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("q"); throw new ArgumentNullException("q");
} }
if (work == null)
{
throw new ArgumentNullException("work");
}
int rowsQ, columnsQ, rowsR, columnsR; int rowsQ, columnsQ, rowsR, columnsR;
if (method == QRMethod.Full) if (method == QRMethod.Full)
{ {
@ -962,35 +794,39 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
columnsQ = rowsR = columnsR = columnsA; columnsQ = rowsR = columnsR = columnsA;
} }
if (r.Length != rowsR*columnsR) if (r.Length != rowsR * columnsR)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsR*columnsR), "r");
}
if (q.Length != rowsQ*columnsQ)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsQ*columnsQ), "q"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsR * columnsR), "r");
} }
if (b.Length != rowsA*columnsB) if (q.Length != rowsQ * columnsQ)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsA*columnsB), "b"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsQ * columnsQ), "q");
} }
if (x.Length != columnsA*columnsB) if (b.Length != rowsA * columnsB)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, columnsA*columnsB), "x"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsA * columnsB), "b");
} }
if (work.Length < 1) if (x.Length != columnsA * columnsB)
{ {
work[0] = rowsA*Control.BlockSize; throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, columnsA * columnsB), "x");
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
if (method == QRMethod.Full) if (method == QRMethod.Full)
{ {
SafeNativeMethods.d_qr_solve_factored(rowsA, columnsA, columnsB, r, b, tau, x, work, work.Length); var info = SafeNativeMethods.d_qr_solve_factored(rowsA, columnsA, columnsB, r, b, tau, x);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
else else
{ {
@ -1000,61 +836,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
} }
} }
/// <summary>
/// Computes the singular value decomposition of A.
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is <c>true</c>, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
[SecuritySafeCritical]
public override void SingularValueDecomposition(bool computeVectors, double[] a, int rowsA, int columnsA, double[] s, double[] u, double[] vt)
{
if (a == null)
{
throw new ArgumentNullException("a");
}
if (s == null)
{
throw new ArgumentNullException("s");
}
if (u == null)
{
throw new ArgumentNullException("u");
}
if (vt == null)
{
throw new ArgumentNullException("vt");
}
if (u.Length != rowsA*rowsA)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "u");
}
if (vt.Length != columnsA*columnsA)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "vt");
}
if (s.Length != Math.Min(rowsA, columnsA))
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "s");
}
var work = new double[Math.Max((3*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA), 5*Math.Min(rowsA, columnsA))];
SingularValueDecomposition(computeVectors, a, rowsA, columnsA, s, u, vt, work);
}
/// <summary> /// <summary>
/// Solves A*X=B for X using the singular value decomposition of A. /// Solves A*X=B for X using the singular value decomposition of A.
/// </summary> /// </summary>
@ -1091,14 +872,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
} }
var work = new double[Math.Max((3*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA), 5*Math.Min(rowsA, columnsA))];
var s = new double[Math.Min(rowsA, columnsA)]; var s = new double[Math.Min(rowsA, columnsA)];
var u = new double[rowsA*rowsA]; var u = new double[rowsA*rowsA];
var vt = new double[columnsA*columnsA]; var vt = new double[columnsA*columnsA];
var clone = new double[a.Length]; var clone = new double[a.Length];
a.Copy(clone); a.Copy(clone);
SingularValueDecomposition(true, clone, rowsA, columnsA, s, u, vt, work); SingularValueDecomposition(true, clone, rowsA, columnsA, s, u, vt);
SvdSolveFactored(rowsA, columnsA, s, u, vt, b, columnsB, x); SvdSolveFactored(rowsA, columnsA, s, u, vt, b, columnsB, x);
} }
@ -1114,12 +894,9 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// singular vectors.</param> /// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed /// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed
/// right singular vectors.</param> /// right singular vectors.</param>
/// <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>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks> /// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void SingularValueDecomposition(bool computeVectors, double[] a, int rowsA, int columnsA, double[] s, double[] u, double[] vt, double[] work) public override void SingularValueDecomposition(bool computeVectors, double[] a, int rowsA, int columnsA, double[] s, double[] u, double[] vt)
{ {
if (a == null) if (a == null)
{ {
@ -1141,17 +918,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("vt"); throw new ArgumentNullException("vt");
} }
if (work == null) if (u.Length != rowsA * rowsA)
{
throw new ArgumentNullException("work");
}
if (u.Length != rowsA*rowsA)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "u"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "u");
} }
if (vt.Length != columnsA*columnsA) if (vt.Length != columnsA * columnsA)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "vt"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "vt");
} }
@ -1161,18 +933,19 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "s"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "s");
} }
if (work.Length == 0) var info = SafeNativeMethods.d_svd_factor(computeVectors, rowsA, columnsA, a, s, u, vt);
if (info == (int)MklError.MemoryAllocation)
{ {
throw new ArgumentException(Resources.ArgumentSingleDimensionArray, "work"); throw new MemoryAllocationException();
} }
if (work.Length < Math.Max((3*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA), 5*Math.Min(rowsA, columnsA))) if (info < 0)
{ {
work[0] = Math.Max((3*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA), 5*Math.Min(rowsA, columnsA)); throw new InvalidParameterException(Math.Abs(info));
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
if (SafeNativeMethods.d_svd_factor(computeVectors, rowsA, columnsA, a, s, u, vt, work, work.Length) > 0) if (info > 0)
{ {
throw new NonConvergenceException(); throw new NonConvergenceException();
} }
@ -1369,7 +1142,19 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(String.Format(Resources.ArgumentArrayWrongLength, order*order), "matrixD"); throw new ArgumentException(String.Format(Resources.ArgumentArrayWrongLength, order*order), "matrixD");
} }
if (SafeNativeMethods.d_eigen(isSymmetric, order, matrix, matrixEv, vectorEv, matrixD) > 0) var info = SafeNativeMethods.d_eigen(isSymmetric, order, matrix, matrixEv, vectorEv, matrixD);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
if (info > 0)
{ {
throw new NonConvergenceException(); throw new NonConvergenceException();
} }

472
src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Single.cs

@ -76,8 +76,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, rows * columns), "matrix"); throw new ArgumentException(string.Format(Resources.ArrayTooSmall, rows * columns), "matrix");
} }
var work = new float[rows]; return SafeNativeMethods.s_matrix_norm((byte)norm, rows, columns, matrix);
return SafeNativeMethods.s_matrix_norm((byte)norm, rows, columns, matrix, work);
} }
/// <summary> /// <summary>
@ -274,7 +273,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
} }
SafeNativeMethods.s_lu_factor(order, data, ipiv); var info = SafeNativeMethods.s_lu_factor(order, data, ipiv);
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -296,77 +300,22 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
} }
var work = new float[order]; var info = SafeNativeMethods.s_lu_inverse(order, a);
SafeNativeMethods.s_lu_inverse(order, a, work, work.Length);
}
/// <summary>
/// Computes the inverse of a previously factored matrix.
/// </summary>
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
/// <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>
[SecuritySafeCritical]
public override void LUInverseFactored(float[] a, int order, int[] ipiv)
{
if (a == null)
{
throw new ArgumentNullException("a");
}
if (ipiv == null)
{
throw new ArgumentNullException("ipiv");
}
if (a.Length != order*order)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
}
if (ipiv.Length != order)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
}
var work = new float[order];
SafeNativeMethods.s_lu_inverse_factored(order, a, ipiv, work, order);
}
/// <summary>
/// Computes the inverse of matrix using LU factorization.
/// </summary>
/// <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>
/// <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>
/// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void LUInverse(float[] a, int order, float[] work)
{
if (a == null)
{
throw new ArgumentNullException("a");
}
if (a.Length != order*order) if (info == (int)MklError.MemoryAllocation)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); throw new MemoryAllocationException();
} }
if (work == null) if (info < 0)
{ {
throw new ArgumentNullException("work"); throw new InvalidParameterException(Math.Abs(info));
} }
if (work.Length < order) if (info > 0)
{ {
throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); throw new SingularUMatrixException(info);
} }
SafeNativeMethods.s_lu_inverse(order, a, work, work.Length);
} }
/// <summary> /// <summary>
@ -375,12 +324,9 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param> /// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param>
/// <param name="order">The order of the square matrix <paramref name="a"/>.</param> /// <param name="order">The order of the square matrix <paramref name="a"/>.</param>
/// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param> /// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks> /// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void LUInverseFactored(float[] a, int order, int[] ipiv, float[] work) public override void LUInverseFactored(float[] a, int order, int[] ipiv)
{ {
if (a == null) if (a == null)
{ {
@ -402,17 +348,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv");
} }
if (work == null) var info = SafeNativeMethods.s_lu_inverse_factored(order, a, ipiv);
{
throw new ArgumentNullException("work");
}
if (work.Length < order) if (info < 0)
{ {
throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); throw new InvalidParameterException(Math.Abs(info));
} }
SafeNativeMethods.s_lu_inverse_factored(order, a, ipiv, work, order); if (info > 0)
{
throw new SingularUMatrixException(info);
}
} }
/// <summary> /// <summary>
@ -446,7 +392,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.s_lu_solve(order, columnsOfB, a, b); var info = SafeNativeMethods.s_lu_solve(order, columnsOfB, a, b);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -491,7 +447,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.s_lu_solve_factored(order, columnsOfB, a, ipiv, b); var info = SafeNativeMethods.s_lu_solve_factored(order, columnsOfB, a, ipiv, b);
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -521,6 +482,11 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
var info = SafeNativeMethods.s_cholesky_factor(order, a); var info = SafeNativeMethods.s_cholesky_factor(order, a);
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
if (info > 0) if (info > 0)
{ {
throw new ArgumentException(Resources.ArgumentMatrixPositiveDefinite); throw new ArgumentException(Resources.ArgumentMatrixPositiveDefinite);
@ -559,7 +525,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.s_cholesky_solve(orderA, columnsB, a, b); var info = SafeNativeMethods.s_cholesky_solve(orderA, columnsB, a, b);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
/// <summary> /// <summary>
@ -593,51 +569,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentReferenceDifferent); throw new ArgumentException(Resources.ArgumentReferenceDifferent);
} }
SafeNativeMethods.s_cholesky_solve_factored(orderA, columnsB, a, b); var info = SafeNativeMethods.s_cholesky_solve_factored(orderA, columnsB, a, b);
}
/// <summary>
/// Computes the QR factorization of A.
/// </summary>
/// <param name="r">On entry, it is the M by N A matrix to factor. On exit,
/// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void QRFactor(float[] r, int rowsR, int columnsR, float[] q, float[] tau)
{
if (r == null)
{
throw new ArgumentNullException("r");
}
if (q == null)
{
throw new ArgumentNullException("q");
}
if (r.Length != rowsR*columnsR) if (info < 0)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r"); throw new InvalidParameterException(Math.Abs(info));
} }
if (tau.Length < Math.Min(rowsR, columnsR))
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, "min(m,n)"), "tau");
}
if (q.Length != rowsR*rowsR)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q");
}
var work = new float[columnsR*Control.BlockSize];
SafeNativeMethods.s_qr_factor(rowsR, columnsR, r, tau, q, work, work.Length);
} }
/// <summary> /// <summary>
@ -647,16 +584,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// it is overwritten with the R matrix of the QR factorization. </param> /// it is overwritten with the R matrix of the QR factorization. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param> /// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param> /// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="q">On exit, A M by M matrix that holds the Q matrix of the /// <param name="q">On exit, A M by M matrix that holds the Q matrix of the
/// QR factorization.</param> /// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information /// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param> /// to be used by the QR solve routine.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks> /// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRFactor(float[] r, int rowsR, int columnsR, float[] q, float[] tau, float[] work) public override void QRFactor(float[] r, int rowsR, int columnsR, float[] q, float[] tau)
{ {
if (r == null) if (r == null)
{ {
@ -668,11 +602,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("q"); throw new ArgumentNullException("q");
} }
if (work == null)
{
throw new ArgumentNullException("work");
}
if (r.Length != rowsR*columnsR) if (r.Length != rowsR*columnsR)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r");
@ -688,13 +617,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q");
} }
if (work.Length < columnsR*Control.BlockSize) var info = SafeNativeMethods.s_qr_factor(rowsR, columnsR, r, tau, q);
if (info < 0)
{ {
work[0] = columnsR*Control.BlockSize; throw new InvalidParameterException(Math.Abs(info));
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
SafeNativeMethods.s_qr_factor(rowsR, columnsR, r, tau, q, work, work.Length);
} }
/// <summary> /// <summary>
@ -737,66 +665,12 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r");
} }
var work = new float[columnsA * Control.BlockSize]; var info = SafeNativeMethods.s_qr_thin_factor(rowsA, columnsA, q, tau, r);
SafeNativeMethods.s_qr_thin_factor(rowsA, columnsA, q, tau, r, work, work.Length);
}
/// <summary> if (info < 0)
/// Computes the thin QR factorization of A where M &gt; N.
/// </summary>
/// <param name="q">On entry, it is the M by N A matrix to factor. On exit,
/// it is overwritten with the Q matrix of the QR factorization.</param>
/// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="r">On exit, A N by N matrix that holds the R matrix of the
/// QR factorization.</param>
/// <param name="tau">A min(m,n) vector. On exit, contains additional information
/// to be used by the QR solve routine.</param>
/// <param name="work">The work array. The array must have a length of at least N,
/// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal
/// work size value.</param>
/// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks>
[SecuritySafeCritical]
public override void ThinQRFactor(float[] q, int rowsA, int columnsA, float[] r, float[] tau, float[] work)
{
if (r == null)
{ {
throw new ArgumentNullException("r"); throw new InvalidParameterException(Math.Abs(info));
} }
if (q == null)
{
throw new ArgumentNullException("q");
}
if (work == null)
{
throw new ArgumentNullException("q");
}
if (q.Length != rowsA*columnsA)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "q");
}
if (tau.Length < Math.Min(rowsA, columnsA))
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, "min(m,n)"), "tau");
}
if (r.Length != columnsA*columnsA)
{
throw new ArgumentException(
string.Format(Resources.ArgumentArrayWrongLength, "columnsA * columnsA"), "r");
}
if (work.Length < columnsA*Control.BlockSize)
{
work[0] = columnsA*Control.BlockSize;
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
}
SafeNativeMethods.s_qr_thin_factor(rowsA, columnsA, q, tau, r, work, work.Length);
} }
/// <summary> /// <summary>
@ -812,27 +686,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// <remarks>Rows must be greater or equal to columns.</remarks> /// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRSolve(float[] a, int rows, int columns, float[] b, int columnsB, float[] x, QRMethod method = QRMethod.Full) public override void QRSolve(float[] a, int rows, int columns, float[] b, int columnsB, float[] x, QRMethod method = QRMethod.Full)
{
var work = new float[columns*Control.BlockSize];
QRSolve(a, rows, columns, b, columnsB, x, work, method);
}
/// <summary>
/// Solves A*X=B for X using QR factorization of A.
/// </summary>
/// <param name="a">The A matrix.</param>
/// <param name="rows">The number of rows in the A matrix.</param>
/// <param name="columns">The number of columns in the A matrix.</param>
/// <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>
/// <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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical]
public override void QRSolve(float[] a, int rows, int columns, float[] b, int columnsB, float[] x, float[] work, QRMethod method = QRMethod.Full)
{ {
if (a == null) if (a == null)
{ {
@ -849,22 +702,17 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("x"); throw new ArgumentNullException("x");
} }
if (work == null) if (a.Length != rows * columns)
{
throw new ArgumentNullException("work");
}
if (a.Length != rows*columns)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "a");
} }
if (b.Length != rows*columnsB) if (b.Length != rows * columnsB)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
} }
if (x.Length != columns*columnsB) if (x.Length != columns * columnsB)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "x"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "x");
} }
@ -874,56 +722,40 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.RowsLessThanColumns); throw new ArgumentException(Resources.RowsLessThanColumns);
} }
if (work.Length < 1) var info = SafeNativeMethods.s_qr_solve(rows, columns, columnsB, a, b, x);
if (info == (int)MklError.MemoryAllocation)
{ {
work[0] = rows*Control.BlockSize; throw new MemoryAllocationException();
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
SafeNativeMethods.s_qr_solve(rows, columns, columnsB, a, b, x, work, work.Length); if (info < 0)
} {
throw new InvalidParameterException(Math.Abs(info));
}
/// <summary> if (info > 0)
/// Solves A*X=B for X using a previously QR factored matrix. {
/// </summary> throw new ArgumentException(Resources.ArgumentMatrixNotRankDeficient, "a");
/// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(float[],int,int,float[],float[])"/>.</param> }
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(float[],int,int,float[],float[])"/>. </param>
/// <param name="rowsR">The number of rows in the A matrix.</param>
/// <param name="columnsR">The number of columns in the A matrix.</param>
/// <param name="tau">Contains additional information on Q. Only used for the native solver
/// and can be <c>null</c> for the managed provider.</param>
/// <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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical]
public override void QRSolveFactored(float[] q, float[] r, int rowsR, int columnsR, float[] tau, float[] b, int columnsB, float[] x, QRMethod method = QRMethod.Full)
{
var work = new float[columnsR*Control.BlockSize];
QRSolveFactored(q, r, rowsR, columnsR, tau, b, columnsB, x, work, method);
} }
/// <summary> /// <summary>
/// Solves A*X=B for X using a previously QR factored matrix. /// Solves A*X=B for X using a previously QR factored matrix.
/// </summary> /// </summary>
/// <param name="q">The Q matrix obtained by QR factor. This is only used for the managed provider and can be /// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(float[],int,int,float[],float[])"/>.</param>
/// <c>null</c> for the native provider. The native provider uses the Q portion stored in the R matrix.</param>
/// <param name="r">The R matrix obtained by calling <see cref="QRFactor(float[],int,int,float[],float[])"/>. </param> /// <param name="r">The R matrix obtained by calling <see cref="QRFactor(float[],int,int,float[],float[])"/>. </param>
/// <param name="rowsA">The number of rows in the A matrix.</param> /// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param> /// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="tau">Contains additional information on Q. Only used for the native solver /// <param name="tau">Contains additional information on Q. Only used for the native solver
/// and can be <c>null</c> for the managed provider.</param> /// and can be <c>null</c> for the managed provider.</param>
/// <param name="b">On entry the B matrix; on exit the X matrix.</param> /// <param name="b">The B matrix.</param>
/// <param name="columnsB">The number of columns of B.</param> /// <param name="columnsB">The number of columns of B.</param>
/// <param name="x">On exit, the solution matrix.</param> /// <param name="x">On exit, the solution matrix.</param>
/// <param name="work">The work array - only used in the native provider. 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>
/// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param> /// <param name="method">The type of QR factorization to perform. <seealso cref="QRMethod"/></param>
/// <remarks>Rows must be greater or equal to columns.</remarks> /// <remarks>Rows must be greater or equal to columns.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void QRSolveFactored(float[] q, float[] r, int rowsA, int columnsA, float[] tau, float[] b, int columnsB, float[] x, float[] work, QRMethod method = QRMethod.Full) public override void QRSolveFactored(float[] q, float[] r, int rowsA, int columnsA, float[] tau, float[] b, int columnsB, float[] x, QRMethod method = QRMethod.Full)
{ {
if (r == null) if (r == null)
{ {
@ -945,11 +777,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("q"); throw new ArgumentNullException("q");
} }
if (work == null)
{
throw new ArgumentNullException("work");
}
int rowsQ, columnsQ, rowsR, columnsR; int rowsQ, columnsQ, rowsR, columnsR;
if (method == QRMethod.Full) if (method == QRMethod.Full)
{ {
@ -962,35 +789,39 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
columnsQ = rowsR = columnsR = columnsA; columnsQ = rowsR = columnsR = columnsA;
} }
if (r.Length != rowsR*columnsR) if (r.Length != rowsR * columnsR)
{
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsR*columnsR), "r");
}
if (q.Length != rowsQ*columnsQ)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsQ*columnsQ), "q"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsR * columnsR), "r");
} }
if (b.Length != rowsA*columnsB) if (q.Length != rowsQ * columnsQ)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsA*columnsB), "b"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsQ * columnsQ), "q");
} }
if (x.Length != columnsA*columnsB) if (b.Length != rowsA * columnsB)
{ {
throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, columnsA*columnsB), "x"); throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, rowsA * columnsB), "b");
} }
if (work.Length < 1) if (x.Length != columnsA * columnsB)
{ {
work[0] = rowsA*Control.BlockSize; throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, columnsA * columnsB), "x");
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
if (method == QRMethod.Full) if (method == QRMethod.Full)
{ {
SafeNativeMethods.s_qr_solve_factored(rowsA, columnsA, columnsB, r, b, tau, x, work, work.Length); var info = SafeNativeMethods.s_qr_solve_factored(rowsA, columnsA, columnsB, r, b, tau, x);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
} }
else else
{ {
@ -1000,61 +831,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
} }
} }
/// <summary>
/// Computes the singular value decomposition of A.
/// </summary>
/// <param name="computeVectors">Compute the singular U and VT vectors or not.</param>
/// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param>
/// <param name="rowsA">The number of rows in the A matrix.</param>
/// <param name="columnsA">The number of columns in the A matrix.</param>
/// <param name="s">The singular values of A in ascending value.</param>
/// <param name="u">If <paramref name="computeVectors"/> is <c>true</c>, on exit U contains the left
/// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed
/// right singular vectors.</param>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
[SecuritySafeCritical]
public override void SingularValueDecomposition(bool computeVectors, float[] a, int rowsA, int columnsA, float[] s, float[] u, float[] vt)
{
if (a == null)
{
throw new ArgumentNullException("a");
}
if (s == null)
{
throw new ArgumentNullException("s");
}
if (u == null)
{
throw new ArgumentNullException("u");
}
if (vt == null)
{
throw new ArgumentNullException("vt");
}
if (u.Length != rowsA*rowsA)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "u");
}
if (vt.Length != columnsA*columnsA)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "vt");
}
if (s.Length != Math.Min(rowsA, columnsA))
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "s");
}
var work = new float[Math.Max(((3*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)), 5*Math.Min(rowsA, columnsA))];
SingularValueDecomposition(computeVectors, a, rowsA, columnsA, s, u, vt, work);
}
/// <summary> /// <summary>
/// Solves A*X=B for X using the singular value decomposition of A. /// Solves A*X=B for X using the singular value decomposition of A.
/// </summary> /// </summary>
@ -1091,14 +867,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "b");
} }
var work = new float[Math.Max(((3*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)), 5*Math.Min(rowsA, columnsA))];
var s = new float[Math.Min(rowsA, columnsA)]; var s = new float[Math.Min(rowsA, columnsA)];
var u = new float[rowsA*rowsA]; var u = new float[rowsA*rowsA];
var vt = new float[columnsA*columnsA]; var vt = new float[columnsA*columnsA];
var clone = new float[a.Length]; var clone = new float[a.Length];
a.Copy(clone); a.Copy(clone);
SingularValueDecomposition(true, clone, rowsA, columnsA, s, u, vt, work); SingularValueDecomposition(true, clone, rowsA, columnsA, s, u, vt);
SvdSolveFactored(rowsA, columnsA, s, u, vt, b, columnsB, x); SvdSolveFactored(rowsA, columnsA, s, u, vt, b, columnsB, x);
} }
@ -1114,12 +889,9 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// singular vectors.</param> /// singular vectors.</param>
/// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed /// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed
/// right singular vectors.</param> /// right singular vectors.</param>
/// <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>
/// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks> /// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks>
[SecuritySafeCritical] [SecuritySafeCritical]
public override void SingularValueDecomposition(bool computeVectors, float[] a, int rowsA, int columnsA, float[] s, float[] u, float[] vt, float[] work) public override void SingularValueDecomposition(bool computeVectors, float[] a, int rowsA, int columnsA, float[] s, float[] u, float[] vt)
{ {
if (a == null) if (a == null)
{ {
@ -1141,11 +913,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentNullException("vt"); throw new ArgumentNullException("vt");
} }
if (work == null)
{
throw new ArgumentNullException("work");
}
if (u.Length != rowsA*rowsA) if (u.Length != rowsA*rowsA)
{ {
throw new ArgumentException(Resources.ArgumentArraysSameLength, "u"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "u");
@ -1161,18 +928,19 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(Resources.ArgumentArraysSameLength, "s"); throw new ArgumentException(Resources.ArgumentArraysSameLength, "s");
} }
if (work.Length == 0) var info = SafeNativeMethods.s_svd_factor(computeVectors, rowsA, columnsA, a, s, u, vt);
if (info == (int)MklError.MemoryAllocation)
{ {
throw new ArgumentException(Resources.ArgumentSingleDimensionArray, "work"); throw new MemoryAllocationException();
} }
if (work.Length < Math.Max(((3*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)), 5*Math.Min(rowsA, columnsA))) if (info < 0)
{ {
work[0] = Math.Max(((3*Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)), 5*Math.Min(rowsA, columnsA)); throw new InvalidParameterException(Math.Abs(info));
throw new ArgumentException(Resources.WorkArrayTooSmall, "work");
} }
if (SafeNativeMethods.s_svd_factor(computeVectors, rowsA, columnsA, a, s, u, vt, work, work.Length) > 0) if (info > 0)
{ {
throw new NonConvergenceException(); throw new NonConvergenceException();
} }
@ -1369,7 +1137,19 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
throw new ArgumentException(String.Format(Resources.ArgumentArrayWrongLength, order*order), "matrixD"); throw new ArgumentException(String.Format(Resources.ArgumentArrayWrongLength, order*order), "matrixD");
} }
if (SafeNativeMethods.s_eigen(isSymmetric, order, matrix, matrixEv, vectorEv, matrixD) > 0) var info = SafeNativeMethods.s_eigen(isSymmetric, order, matrix, matrixEv, vectorEv, matrixD);
if (info == (int)MklError.MemoryAllocation)
{
throw new MemoryAllocationException();
}
if (info < 0)
{
throw new InvalidParameterException(Math.Abs(info));
}
if (info > 0)
{ {
throw new NonConvergenceException(); throw new NonConvergenceException();
} }

11
src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs

@ -34,6 +34,17 @@ using System;
namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
{ {
/// <summary>
/// Error codes return from the MKL provider.
/// </summary>
public enum MklError : int
{
/// <summary>
/// Unable to allocate memory.
/// </summary>
MemoryAllocation = -999999
}
/// <summary> /// <summary>
/// Consistency vs. performance trade-off between runs on different machines. /// Consistency vs. performance trade-off between runs on different machines.
/// </summary> /// </summary>

64
src/Numerics/Providers/LinearAlgebra/Mkl/SafeNativeMethods.cs

@ -134,16 +134,16 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
#region LAPACK #region LAPACK
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern float s_matrix_norm(byte norm, int rows, int columns, [In] float[] a, [In, Out] float[] work); internal static extern float s_matrix_norm(byte norm, int rows, int columns, [In] float[] a);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern double d_matrix_norm(byte norm, int rows, int columns, [In] double[] a, [In, Out] double[] work); internal static extern double d_matrix_norm(byte norm, int rows, int columns, [In] double[] a);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern float c_matrix_norm(byte norm, int rows, int columns, [In] Complex32[] a, [In, Out] float[] work); internal static extern float c_matrix_norm(byte norm, int rows, int columns, [In] Complex32[] a);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern double z_matrix_norm(byte norm, int rows, int columns, [In] Complex[] a, [In, Out] double[] work); internal static extern double z_matrix_norm(byte norm, int rows, int columns, [In] Complex[] a);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_cholesky_factor(int n, [In, Out] float[] a); internal static extern int s_cholesky_factor(int n, [In, Out] float[] a);
@ -170,28 +170,28 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
internal static extern int z_lu_factor(int n, [In, Out] Complex[] a, [In, Out] int[] ipiv); internal static extern int z_lu_factor(int n, [In, Out] Complex[] a, [In, Out] int[] ipiv);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_lu_inverse(int n, [In, Out] float[] a, [In, Out] float[] work, int lwork); internal static extern int s_lu_inverse(int n, [In, Out] float[] a);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int d_lu_inverse(int n, [In, Out] double[] a, [In, Out] double[] work, int lwork); internal static extern int d_lu_inverse(int n, [In, Out] double[] a);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int c_lu_inverse(int n, [In, Out] Complex32[] a, [In, Out] Complex32[] work, int lwork); internal static extern int c_lu_inverse(int n, [In, Out] Complex32[] a);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int z_lu_inverse(int n, [In, Out] Complex[] a, [In, Out] Complex[] work, int lwork); internal static extern int z_lu_inverse(int n, [In, Out] Complex[] a);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_lu_inverse_factored(int n, [In, Out] float[] a, [In, Out] int[] ipiv, [In, Out] float[] work, int lwork); internal static extern int s_lu_inverse_factored(int n, [In, Out] float[] a, [In, Out] int[] ipiv);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int d_lu_inverse_factored(int n, [In, Out] double[] a, [In, Out] int[] ipiv, [In, Out] double[] work, int lwork); internal static extern int d_lu_inverse_factored(int n, [In, Out] double[] a, [In, Out] int[] ipiv);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int c_lu_inverse_factored(int n, [In, Out] Complex32[] a, [In, Out] int[] ipiv, [In, Out] Complex32[] work, int lwork); internal static extern int c_lu_inverse_factored(int n, [In, Out] Complex32[] a, [In, Out] int[] ipiv);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int z_lu_inverse_factored(int n, [In, Out] Complex[] a, [In, Out] int[] ipiv, [In, Out] Complex[] work, int lwork); internal static extern int z_lu_inverse_factored(int n, [In, Out] Complex[] a, [In, Out] int[] ipiv);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_lu_solve_factored(int n, int nrhs, float[] a, [In, Out] int[] ipiv, [In, Out] float[] b); internal static extern int s_lu_solve_factored(int n, int nrhs, float[] a, [In, Out] int[] ipiv, [In, Out] float[] b);
@ -242,64 +242,64 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
internal static extern int z_cholesky_solve_factored(int n, int nrhs, Complex[] a, [In, Out] Complex[] b); internal static extern int z_cholesky_solve_factored(int n, int nrhs, Complex[] a, [In, Out] Complex[] b);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_qr_factor(int m, int n, [In, Out] float[] r, [In, Out] float[] tau, [In, Out] float[] q, [In, Out] float[] work, int len); internal static extern int s_qr_factor(int m, int n, [In, Out] float[] r, [In, Out] float[] tau, [In, Out] float[] q);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int d_qr_factor(int m, int n, [In, Out] double[] r, [In, Out] double[] tau, [In, Out] double[] q, [In, Out] double[] work, int len); internal static extern int d_qr_factor(int m, int n, [In, Out] double[] r, [In, Out] double[] tau, [In, Out] double[] q);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int c_qr_factor(int m, int n, [In, Out] Complex32[] r, [In, Out] Complex32[] tau, [In, Out] Complex32[] q, [In, Out] Complex32[] work, int len); internal static extern int c_qr_factor(int m, int n, [In, Out] Complex32[] r, [In, Out] Complex32[] tau, [In, Out] Complex32[] q);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int z_qr_factor(int m, int n, [In, Out] Complex[] r, [In, Out] Complex[] tau, [In, Out] Complex[] q, [In, Out] Complex[] work, int len); internal static extern int z_qr_factor(int m, int n, [In, Out] Complex[] r, [In, Out] Complex[] tau, [In, Out] Complex[] q);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_qr_thin_factor(int m, int n, [In, Out] float[] q, [In, Out] float[] tau, [In, Out] float[] r, [In, Out] float[] work, int len); internal static extern int s_qr_thin_factor(int m, int n, [In, Out] float[] q, [In, Out] float[] tau, [In, Out] float[] r);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int d_qr_thin_factor(int m, int n, [In, Out] double[] q, [In, Out] double[] tau, [In, Out] double[] r, [In, Out] double[] work, int len); internal static extern int d_qr_thin_factor(int m, int n, [In, Out] double[] q, [In, Out] double[] tau, [In, Out] double[] r);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int c_qr_thin_factor(int m, int n, [In, Out] Complex32[] q, [In, Out] Complex32[] tau, [In, Out] Complex32[] r, [In, Out] Complex32[] work, int len); internal static extern int c_qr_thin_factor(int m, int n, [In, Out] Complex32[] q, [In, Out] Complex32[] tau, [In, Out] Complex32[] r);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int z_qr_thin_factor(int m, int n, [In, Out] Complex[] q, [In, Out] Complex[] tau, [In, Out] Complex[] r, [In, Out] Complex[] work, int len); internal static extern int z_qr_thin_factor(int m, int n, [In, Out] Complex[] q, [In, Out] Complex[] tau, [In, Out] Complex[] r);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_qr_solve(int m, int n, int bn, float[] r, float[] b, [In, Out] float[] x, [In, Out] float[] work, int len); internal static extern int s_qr_solve(int m, int n, int bn, float[] r, float[] b, [In, Out] float[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int d_qr_solve(int m, int n, int bn, double[] r, double[] b, [In, Out] double[] x, [In, Out] double[] work, int len); internal static extern int d_qr_solve(int m, int n, int bn, double[] r, double[] b, [In, Out] double[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int c_qr_solve(int m, int n, int bn, Complex32[] r, Complex32[] b, [In, Out] Complex32[] x, [In, Out] Complex32[] work, int len); internal static extern int c_qr_solve(int m, int n, int bn, Complex32[] r, Complex32[] b, [In, Out] Complex32[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int z_qr_solve(int m, int n, int bn, Complex[] r, Complex[] b, [In, Out] Complex[] x, [In, Out] Complex[] work, int len); internal static extern int z_qr_solve(int m, int n, int bn, Complex[] r, Complex[] b, [In, Out] Complex[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_qr_solve_factored(int m, int n, int bn, float[] r, float[] b, float[] tau, [In, Out] float[] x, [In, Out] float[] work, int len); internal static extern int s_qr_solve_factored(int m, int n, int bn, float[] r, float[] b, float[] tau, [In, Out] float[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int d_qr_solve_factored(int m, int n, int bn, double[] r, double[] b, double[] tau, [In, Out] double[] x, [In, Out] double[] work, int len); internal static extern int d_qr_solve_factored(int m, int n, int bn, double[] r, double[] b, double[] tau, [In, Out] double[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int c_qr_solve_factored(int m, int n, int bn, Complex32[] r, Complex32[] b, Complex32[] tau, [In, Out] Complex32[] x, [In, Out] Complex32[] work, int len); internal static extern int c_qr_solve_factored(int m, int n, int bn, Complex32[] r, Complex32[] b, Complex32[] tau, [In, Out] Complex32[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int z_qr_solve_factored(int m, int n, int bn, Complex[] r, Complex[] b, Complex[] tau, [In, Out] Complex[] x, [In, Out] Complex[] work, int len); internal static extern int z_qr_solve_factored(int m, int n, int bn, Complex[] r, Complex[] b, Complex[] tau, [In, Out] Complex[] x);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_svd_factor([MarshalAs(UnmanagedType.U1)] bool computeVectors, int m, int n, [In, Out] float[] a, [In, Out] float[] s, [In, Out] float[] u, [In, Out] float[] v, [In, Out] float[] work, int len); internal static extern int s_svd_factor([MarshalAs(UnmanagedType.U1)] bool computeVectors, int m, int n, [In, Out] float[] a, [In, Out] float[] s, [In, Out] float[] u, [In, Out] float[] v);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int d_svd_factor([MarshalAs(UnmanagedType.U1)] bool computeVectors, int m, int n, [In, Out] double[] a, [In, Out] double[] s, [In, Out] double[] u, [In, Out] double[] v, [In, Out] double[] work, int len); internal static extern int d_svd_factor([MarshalAs(UnmanagedType.U1)] bool computeVectors, int m, int n, [In, Out] double[] a, [In, Out] double[] s, [In, Out] double[] u, [In, Out] double[] v);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int c_svd_factor([MarshalAs(UnmanagedType.U1)] bool computeVectors, int m, int n, [In, Out] Complex32[] a, [In, Out] Complex32[] s, [In, Out] Complex32[] u, [In, Out] Complex32[] v, [In, Out] Complex32[] work, int len); internal static extern int c_svd_factor([MarshalAs(UnmanagedType.U1)] bool computeVectors, int m, int n, [In, Out] Complex32[] a, [In, Out] Complex32[] s, [In, Out] Complex32[] u, [In, Out] Complex32[] v);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int z_svd_factor([MarshalAs(UnmanagedType.U1)] bool computeVectors, int m, int n, [In, Out] Complex[] a, [In, Out] Complex[] s, [In, Out] Complex[] u, [In, Out] Complex[] v, [In, Out] Complex[] work, int len); internal static extern int z_svd_factor([MarshalAs(UnmanagedType.U1)] bool computeVectors, int m, int n, [In, Out] Complex[] a, [In, Out] Complex[] s, [In, Out] Complex[] u, [In, Out] Complex[] v);
[DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)] [DllImport(_DllName, ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int s_eigen([MarshalAs(UnmanagedType.U1)] bool isSymmetric, int n, [In] float[] a, [In, Out] float[] vectors, [In, Out] Complex[] values, [In, Out] float[] d); internal static extern int s_eigen([MarshalAs(UnmanagedType.U1)] bool isSymmetric, int n, [In] float[] a, [In, Out] float[] vectors, [In, Out] Complex[] values, [In, Out] float[] d);

16
src/UnitTests/LinearAlgebraProviderTests/Complex/LinearAlgebraProviderTests.cs

@ -433,6 +433,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
AssertHelpers.AlmostEqualRelative(a[8], -0.113636363636364, 13); AssertHelpers.AlmostEqualRelative(a[8], -0.113636363636364, 13);
} }
#if ! MKL
/// <summary> /// <summary>
/// Can compute the inverse of a matrix using LU factorization /// Can compute the inverse of a matrix using LU factorization
/// with a work array. /// with a work array.
@ -461,7 +462,9 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
AssertHelpers.AlmostEqualRelative(a[7], 0.227272727272727, 13); AssertHelpers.AlmostEqualRelative(a[7], 0.227272727272727, 13);
AssertHelpers.AlmostEqualRelative(a[8], -0.113636363636364, 13); AssertHelpers.AlmostEqualRelative(a[8], -0.113636363636364, 13);
} }
#endif
#if ! MKL
/// <summary> /// <summary>
/// Can compute the inverse of a matrix using LU factorization /// Can compute the inverse of a matrix using LU factorization
/// using a previously factored matrix with a work array. /// using a previously factored matrix with a work array.
@ -494,6 +497,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
AssertHelpers.AlmostEqualRelative(a[7], 0.227272727272727, 13); AssertHelpers.AlmostEqualRelative(a[7], 0.227272727272727, 13);
AssertHelpers.AlmostEqualRelative(a[8], -0.113636363636364, 13); AssertHelpers.AlmostEqualRelative(a[8], -0.113636363636364, 13);
} }
#endif
/// <summary> /// <summary>
/// Can solve Ax=b using LU factorization. /// Can solve Ax=b using LU factorization.
@ -692,6 +696,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
} }
} }
#if ! MKL
/// <summary> /// <summary>
/// Can compute QR factorization of a square matrix using a work array. /// Can compute QR factorization of a square matrix using a work array.
/// </summary> /// </summary>
@ -775,6 +780,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
} }
} }
} }
#endif
/// <summary> /// <summary>
/// Can compute thin QR factorization of a square matrix. /// Can compute thin QR factorization of a square matrix.
@ -830,6 +836,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
} }
} }
#if ! MKL
/// <summary> /// <summary>
/// Can compute thin QR factorization of a square matrix using a work array. /// Can compute thin QR factorization of a square matrix using a work array.
/// </summary> /// </summary>
@ -884,6 +891,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
} }
} }
} }
#endif
/// <summary> /// <summary>
/// Can solve Ax=b using QR factorization with a square A matrix. /// Can solve Ax=b using QR factorization with a square A matrix.
@ -936,6 +944,8 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
AssertHelpers.AlmostEqualRelative(test[1, 1], x[3], 13); AssertHelpers.AlmostEqualRelative(test[1, 1], x[3], 13);
} }
#if ! MKL
/// <summary> /// <summary>
/// Can solve Ax=b using QR factorization with a square A matrix /// Can solve Ax=b using QR factorization with a square A matrix
/// using a work array. /// using a work array.
@ -1021,7 +1031,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
AssertHelpers.AlmostEqualRelative(mb[1, 1], b[4], 13); AssertHelpers.AlmostEqualRelative(mb[1, 1], b[4], 13);
AssertHelpers.AlmostEqualRelative(mb[2, 1], b[5], 13); AssertHelpers.AlmostEqualRelative(mb[2, 1], b[5], 13);
} }
#endif
/// <summary> /// <summary>
/// Can solve Ax=b using QR factorization with a tall A matrix /// Can solve Ax=b using QR factorization with a tall A matrix
/// using a factored A matrix. /// using a factored A matrix.
@ -1050,6 +1060,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
AssertHelpers.AlmostEqualRelative(test[1, 1], x[3], 13); AssertHelpers.AlmostEqualRelative(test[1, 1], x[3], 13);
} }
#if ! MKL
/// <summary> /// <summary>
/// Can solve Ax=b using QR factorization with a square A matrix /// Can solve Ax=b using QR factorization with a square A matrix
/// using a factored A matrix with a work array. /// using a factored A matrix with a work array.
@ -1109,6 +1120,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
AssertHelpers.AlmostEqualRelative(test[0, 1], x[2], 13); AssertHelpers.AlmostEqualRelative(test[0, 1], x[2], 13);
AssertHelpers.AlmostEqualRelative(test[1, 1], x[3], 13); AssertHelpers.AlmostEqualRelative(test[1, 1], x[3], 13);
} }
#endif
/// <summary> /// <summary>
/// Can solve Ax=b using thin QR factorization with a square A matrix. /// Can solve Ax=b using thin QR factorization with a square A matrix.
@ -1162,6 +1174,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
AssertHelpers.AlmostEqualRelative(test[1, 1], x[3], 13); AssertHelpers.AlmostEqualRelative(test[1, 1], x[3], 13);
} }
#if ! MKL
/// <summary> /// <summary>
/// Can solve Ax=b using thin QR factorization with a square A matrix /// Can solve Ax=b using thin QR factorization with a square A matrix
/// using a work array. /// using a work array.
@ -1217,6 +1230,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
AssertHelpers.AlmostEqualRelative(test[0, 1], x[2], 13); AssertHelpers.AlmostEqualRelative(test[0, 1], x[2], 13);
AssertHelpers.AlmostEqualRelative(test[1, 1], x[3], 13); AssertHelpers.AlmostEqualRelative(test[1, 1], x[3], 13);
} }
#endif
/// <summary> /// <summary>
/// Can solve Ax=b using thin QR factorization with a square A matrix /// Can solve Ax=b using thin QR factorization with a square A matrix

326
src/UnitTests/UnitTests-MKL.csproj

@ -52,8 +52,324 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="**\*.cs" Exclude="Properties\Settings.Designer.cs"> <Compile Include="ArrayHelpers.cs" />
</Compile> <Compile Include="AssertHelpers.cs" />
<Compile Include="CombinatoricsTests\CombinatoricsCountingTest.cs" />
<Compile Include="ComplexTests\Complex32Test.cs" />
<Compile Include="ComplexTests\Complex32Test.TextHandling.cs" />
<Compile Include="ComplexTests\ComplexTest.cs" />
<Compile Include="ComplexTests\ComplexTest.TextHandling.cs" />
<Compile Include="DifferentiationTests\FiniteDifferenceCoefficientsTests.cs" />
<Compile Include="DifferentiationTests\NumericalDerivativeTests.cs" />
<Compile Include="DifferentiationTests\NumericalHessianTests.cs" />
<Compile Include="DifferentiationTests\NumericalJacobianTests.cs" />
<Compile Include="DistanceTests.cs" />
<Compile Include="DistributionTests\CommonDistributionTests.cs" />
<Compile Include="DistributionTests\Continuous\BetaTests.cs" />
<Compile Include="DistributionTests\Continuous\CauchyTests.cs" />
<Compile Include="DistributionTests\Continuous\ChiSquareTests.cs" />
<Compile Include="DistributionTests\Continuous\ChiTests.cs" />
<Compile Include="DistributionTests\Continuous\ContinuousUniformTests.cs" />
<Compile Include="DistributionTests\Continuous\ErlangTests.cs" />
<Compile Include="DistributionTests\Continuous\ExponentialTests.cs" />
<Compile Include="DistributionTests\Continuous\FisherSnedecorTests.cs" />
<Compile Include="DistributionTests\Continuous\GammaTests.cs" />
<Compile Include="DistributionTests\Continuous\InverseGammaTests.cs" />
<Compile Include="DistributionTests\Continuous\LaplaceTests.cs" />
<Compile Include="DistributionTests\Continuous\LogNormalTests.cs" />
<Compile Include="DistributionTests\Continuous\NormalTests.cs" />
<Compile Include="DistributionTests\Continuous\ParetoTests.cs" />
<Compile Include="DistributionTests\Continuous\RayleighTests.cs" />
<Compile Include="DistributionTests\Continuous\StableTests.cs" />
<Compile Include="DistributionTests\Continuous\StudentTTests.cs" />
<Compile Include="DistributionTests\Continuous\TriangularTests.cs" />
<Compile Include="DistributionTests\Continuous\WeibullTests.cs" />
<Compile Include="DistributionTests\Discrete\BernoulliTests.cs" />
<Compile Include="DistributionTests\Discrete\BinomialTests.cs" />
<Compile Include="DistributionTests\Discrete\CategoricalTests.cs" />
<Compile Include="DistributionTests\Discrete\ConwayMaxwellPoissonTests.cs" />
<Compile Include="DistributionTests\Discrete\DiscreteUniformTests.cs" />
<Compile Include="DistributionTests\Discrete\GeometricTests.cs" />
<Compile Include="DistributionTests\Discrete\HypergeometricTests.cs" />
<Compile Include="DistributionTests\Discrete\NegativeBinomialTests.cs" />
<Compile Include="DistributionTests\Discrete\PoissonTests.cs" />
<Compile Include="DistributionTests\Discrete\ZipfTests.cs" />
<Compile Include="DistributionTests\Multivariate\DirichletTests.cs" />
<Compile Include="DistributionTests\Multivariate\InverseWishartTests.cs" />
<Compile Include="DistributionTests\Multivariate\MatrixNormalTests.cs" />
<Compile Include="DistributionTests\Multivariate\MultinomialTests.cs" />
<Compile Include="DistributionTests\Multivariate\NormalGammaTests.cs" />
<Compile Include="DistributionTests\Multivariate\WishartTests.cs" />
<Compile Include="EuclidTests\GcdRelatedTest.cs" />
<Compile Include="EuclidTests\GcdRelatedTestBigInteger.cs" />
<Compile Include="EuclidTests\IntegerTheoryTest.cs" />
<Compile Include="ExcelTests.cs" />
<Compile Include="FinancialTests\DownsideDeviationTests.cs" />
<Compile Include="FinancialTests\GainLossRatioTests.cs" />
<Compile Include="FinancialTests\GainMeanTests.cs" />
<Compile Include="FinancialTests\GainStandardDeviationTests.cs" />
<Compile Include="FinancialTests\LossMeanTests.cs" />
<Compile Include="FinancialTests\LossStandardDeviationTests.cs" />
<Compile Include="FinancialTests\SemiDeviationTests.cs" />
<Compile Include="FitTests.cs" />
<Compile Include="GenerateTests.cs" />
<Compile Include="GenericMath.cs" />
<Compile Include="GoodnessOfFit\RSquaredTest.cs" />
<Compile Include="IntegralTransformsTests\FourierTest.cs" />
<Compile Include="IntegralTransformsTests\HartleyTest.cs" />
<Compile Include="IntegralTransformsTests\InverseTransformTest.cs" />
<Compile Include="IntegralTransformsTests\MatchingNaiveTransformTest.cs" />
<Compile Include="IntegralTransformsTests\ParsevalTheoremTest.cs" />
<Compile Include="IntegrationTests\IntegrationTest.cs" />
<Compile Include="InterpolationTests\AkimaSplineTest.cs" />
<Compile Include="InterpolationTests\BulirschStoerRationalTest.cs" />
<Compile Include="InterpolationTests\CubicSplineTest.cs" />
<Compile Include="InterpolationTests\EquidistantPolynomialTest.cs" />
<Compile Include="InterpolationTests\FloaterHormannRationalTest.cs" />
<Compile Include="InterpolationTests\LinearInterpolationCase.cs" />
<Compile Include="InterpolationTests\LinearSplineTest.cs" />
<Compile Include="InterpolationTests\NevillePolynomialTest.cs" />
<Compile Include="InterpolationTests\StepInterpolationTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\DenseMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\DenseVectorTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\DiagonalMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\CholeskyTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\EvdTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\GramSchmidtTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\LUTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\QRTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\SvdTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\UserCholeskyTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\UserEvdTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\UserGramSchmidtTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\UserLUTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\UserQRTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Factorization\UserSvdTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\MatrixLoader.cs" />
<Compile Include="LinearAlgebraTests\Complex32\MatrixStructureTheory.cs" />
<Compile Include="LinearAlgebraTests\Complex32\MatrixTests.Arithmetic.cs" />
<Compile Include="LinearAlgebraTests\Complex32\MatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\ReturnTypeTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\Iterative\BiCgStabTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\Iterative\GpBiCgTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\Iterative\MlkBiCgStabTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\Iterative\TFQMRTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\IteratorTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\Preconditioners\DiagonalTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\Preconditioners\IluptElementSorterTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\Preconditioners\IlutpTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\Preconditioners\IncompleteLUTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\Preconditioners\PreConditionerTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\Preconditioners\UnitPreconditionerTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\StopCriterion\DivergenceStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\StopCriterion\FailureStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\StopCriterion\IterationCountStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\Solvers\StopCriterion\ResidualStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\SparseMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\SparseVectorTest.cs" />
<Compile Include="LinearAlgebraTests\Complex32\TestData.cs" />
<Compile Include="LinearAlgebraTests\Complex32\UserDefinedMatrix.cs" />
<Compile Include="LinearAlgebraTests\Complex32\UserDefinedMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\UserDefinedVector.cs" />
<Compile Include="LinearAlgebraTests\Complex32\UserDefinedVectorTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\VectorArithmeticTheory.cs" />
<Compile Include="LinearAlgebraTests\Complex32\VectorTests.Arithmetic.cs" />
<Compile Include="LinearAlgebraTests\Complex32\VectorTests.cs" />
<Compile Include="LinearAlgebraTests\Complex32\VectorTests.Norm.cs" />
<Compile Include="LinearAlgebraTests\Complex\DenseMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\DenseVectorTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\DiagonalMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\CholeskyTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\EvdTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\GramSchmidtTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\LUTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\QRTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\SvdTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\UserCholeskyTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\UserEvdTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\UserGramSchmidtTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\UserLUTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\UserQRTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Factorization\UserSvdTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\MatrixLoader.cs" />
<Compile Include="LinearAlgebraTests\Complex\MatrixStructureTheory.cs" />
<Compile Include="LinearAlgebraTests\Complex\MatrixTests.Arithmetic.cs" />
<Compile Include="LinearAlgebraTests\Complex\MatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\ReturnTypeTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\Iterative\BiCgStabTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\Iterative\GpBiCgTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\Iterative\MlkBiCgStabTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\Iterative\TFQMRTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\IteratorTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\Preconditioners\DiagonalTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\Preconditioners\IluptElementSorterTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\Preconditioners\IlutpTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\Preconditioners\IncompleteLUTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\Preconditioners\PreConditionerTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\Preconditioners\UnitPreconditionerTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\StopCriterion\DivergenceStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\StopCriterion\FailureStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\StopCriterion\IterationCountStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\Solvers\StopCriterion\ResidualStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\SparseMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\SparseVectorTest.cs" />
<Compile Include="LinearAlgebraTests\Complex\TestData.cs" />
<Compile Include="LinearAlgebraTests\Complex\UserDefinedMatrix.cs" />
<Compile Include="LinearAlgebraTests\Complex\UserDefinedMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\UserDefinedVector.cs" />
<Compile Include="LinearAlgebraTests\Complex\UserDefinedVectorTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\VectorArithmeticTheory.cs" />
<Compile Include="LinearAlgebraTests\Complex\VectorTests.Arithmetic.cs" />
<Compile Include="LinearAlgebraTests\Complex\VectorTests.cs" />
<Compile Include="LinearAlgebraTests\Complex\VectorTests.Norm.cs" />
<Compile Include="LinearAlgebraTests\Double\DenseMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Double\DenseVectorTests.cs" />
<Compile Include="LinearAlgebraTests\Double\DiagonalMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\CholeskyTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\EvdTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\GramSchmidtTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\LUTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\QRTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\SvdTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\UserCholeskyTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\UserEvdTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\UserGramSchmidtTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\UserLUTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\UserQRTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Factorization\UserSvdTests.cs" />
<Compile Include="LinearAlgebraTests\Double\MatrixLoader.cs" />
<Compile Include="LinearAlgebraTests\Double\MatrixStructureTheory.cs" />
<Compile Include="LinearAlgebraTests\Double\MatrixTests.Arithmetic.cs" />
<Compile Include="LinearAlgebraTests\Double\MatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Double\ReturnTypeTests.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\Iterative\BiCgStabTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\Iterative\GpBiCgTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\Iterative\MlkBiCgStabTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\Iterative\TFQMRTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\IteratorTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\Preconditioners\DiagonalTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\Preconditioners\IluptElementSorterTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\Preconditioners\IlutpTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\Preconditioners\IncompleteLUTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\Preconditioners\PreConditionerTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\Preconditioners\UnitPreconditionerTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\StopCriterion\DivergenceStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\StopCriterion\FailureStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\StopCriterion\IterationCountStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Double\Solvers\StopCriterion\ResidualStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Double\SparseMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Double\SparseVectorTest.cs" />
<Compile Include="LinearAlgebraTests\Double\TestData.cs" />
<Compile Include="LinearAlgebraTests\Double\UserDefinedMatrix.cs" />
<Compile Include="LinearAlgebraTests\Double\UserDefinedMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Double\UserDefinedVector.cs" />
<Compile Include="LinearAlgebraTests\Double\UserDefinedVectorTests.cs" />
<Compile Include="LinearAlgebraTests\Double\VectorArithmeticTheory.cs" />
<Compile Include="LinearAlgebraTests\Double\VectorTests.Arithmetic.cs" />
<Compile Include="LinearAlgebraTests\Double\VectorTests.cs" />
<Compile Include="LinearAlgebraTests\Double\VectorTests.Norm.cs" />
<Compile Include="LinearAlgebraTests\MatrixHelpers.cs" />
<Compile Include="LinearAlgebraTests\MatrixStorageCombinatorsTests.cs" />
<Compile Include="LinearAlgebraTests\MatrixStructureTheory.Access.cs" />
<Compile Include="LinearAlgebraTests\MatrixStructureTheory.cs" />
<Compile Include="LinearAlgebraTests\MatrixStructureTheory.Functional.cs" />
<Compile Include="LinearAlgebraTests\MatrixStructureTheory.Reform.cs" />
<Compile Include="LinearAlgebraTests\Single\DenseMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Single\DenseVectorTests.cs" />
<Compile Include="LinearAlgebraTests\Single\DiagonalMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\CholeskyTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\EvdTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\GramSchmidtTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\LUTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\QRTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\SvdTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\UserCholeskyTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\UserEvdTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\UserGramSchmidtTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\UserLUTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\UserQRTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Factorization\UserSvdTests.cs" />
<Compile Include="LinearAlgebraTests\Single\MatrixLoader.cs" />
<Compile Include="LinearAlgebraTests\Single\MatrixStructureTheory.cs" />
<Compile Include="LinearAlgebraTests\Single\MatrixTests.Arithmetic.cs" />
<Compile Include="LinearAlgebraTests\Single\MatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Single\ReturnTypeTests.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\Iterative\BiCgStabTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\Iterative\GpBiCgTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\Iterative\MlkBiCgStabTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\Iterative\TFQMRTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\IteratorTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\Preconditioners\DiagonalTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\Preconditioners\IluptElementSorterTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\Preconditioners\IlutpTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\Preconditioners\IncompleteLUTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\Preconditioners\PreConditionerTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\Preconditioners\UnitPreconditionerTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\StopCriterion\DivergenceStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\StopCriterion\FailureStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\StopCriterion\IterationCountStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Single\Solvers\StopCriterion\ResidualStopCriteriumTest.cs" />
<Compile Include="LinearAlgebraTests\Single\SparseMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Single\SparseVectorTest.cs" />
<Compile Include="LinearAlgebraTests\Single\TestData.cs" />
<Compile Include="LinearAlgebraTests\Single\UserDefinedMatrix.cs" />
<Compile Include="LinearAlgebraTests\Single\UserDefinedMatrixTests.cs" />
<Compile Include="LinearAlgebraTests\Single\UserDefinedVector.cs" />
<Compile Include="LinearAlgebraTests\Single\UserDefinedVectorTests.cs" />
<Compile Include="LinearAlgebraTests\Single\VectorArithmeticTheory.cs" />
<Compile Include="LinearAlgebraTests\Single\VectorTests.Arithmetic.cs" />
<Compile Include="LinearAlgebraTests\Single\VectorTests.cs" />
<Compile Include="LinearAlgebraTests\Single\VectorTests.Norm.cs" />
<Compile Include="LinearAlgebraTests\TestData.cs" />
<Compile Include="LinearAlgebraTests\VectorArithmeticTheory.cs" />
<Compile Include="LinearAlgebraTests\VectorStorageCombinatorsTests.cs" />
<Compile Include="PermutationTest.cs" />
<Compile Include="PrecisionTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Random\CryptoRandomSourceTests.cs" />
<Compile Include="Random\Mcg31m1Tests.cs" />
<Compile Include="Random\Mcg59Tests.cs" />
<Compile Include="Random\MersenneTwisterTests.cs" />
<Compile Include="Random\Mrg32k3aTests.cs" />
<Compile Include="Random\PalfTests.cs" />
<Compile Include="Random\RandomExtensionTests.cs" />
<Compile Include="Random\RandomTests.cs" />
<Compile Include="Random\SystemRandomSourceTests.cs" />
<Compile Include="Random\WH1982Tests.cs" />
<Compile Include="Random\WH2006Tests.cs" />
<Compile Include="Random\XorshiftTests.cs" />
<Compile Include="RootFindingTests\BisectionTest.cs" />
<Compile Include="RootFindingTests\BrentTest.cs" />
<Compile Include="RootFindingTests\BroydenTest.cs" />
<Compile Include="RootFindingTests\CubicTest.cs" />
<Compile Include="RootFindingTests\FindRootsTest.cs" />
<Compile Include="RootFindingTests\NewtonRaphsonTest.cs" />
<Compile Include="RootFindingTests\RobustNewtonRaphsonTest.cs" />
<Compile Include="SortingTests.cs" />
<Compile Include="SpecialFunctionsTests\ErfTests.cs" />
<Compile Include="SpecialFunctionsTests\ExponentialIntegralTests.cs" />
<Compile Include="SpecialFunctionsTests\FactorialTest.cs" />
<Compile Include="SpecialFunctionsTests\GammaTests.cs" />
<Compile Include="SpecialFunctionsTests\ModifiedBesselTests.cs" />
<Compile Include="SpecialFunctionsTests\ModifiedStruveTests.cs" />
<Compile Include="SpecialFunctionsTests\SpecialFunctionsTests.cs" />
<Compile Include="StatisticsTests\CorrelationTests.cs" />
<Compile Include="StatisticsTests\DescriptiveStatisticsTests.cs" />
<Compile Include="StatisticsTests\HistogramTests.cs" />
<Compile Include="StatisticsTests\MCMCTests\HybridMCTest.cs" />
<Compile Include="StatisticsTests\MCMCTests\MCMCDiagnosticsTest.cs" />
<Compile Include="StatisticsTests\MCMCTests\MetropolisHastingsSamplerTests.cs" />
<Compile Include="StatisticsTests\MCMCTests\MetropolisSamplerTests.cs" />
<Compile Include="StatisticsTests\MCMCTests\RejectionSamplerTests.cs" />
<Compile Include="StatisticsTests\MCMCTests\UnivariateHybridMCTest.cs" />
<Compile Include="StatisticsTests\MCMCTests\UnivariateSliceSamplerTests.cs" />
<Compile Include="StatisticsTests\MovingStatisticsTests.cs" />
<Compile Include="StatisticsTests\PercentileTests.cs" />
<Compile Include="StatisticsTests\RunningStatisticsTests.cs" />
<Compile Include="StatisticsTests\StatisticsTests.cs" />
<Compile Include="StatisticsTests\StatTestData.cs" />
<Compile Include="TrigonometryTest.cs" />
<Compile Include="UseLinearAlgebraProvider.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\..\data\Codeplex-5667.csv"> <None Include="..\..\data\Codeplex-5667.csv">
@ -348,4 +664,10 @@
<ItemGroup> <ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="LinearAlgebraProviderTests\Complex32\" />
<Folder Include="LinearAlgebraProviderTests\Complex\" />
<Folder Include="LinearAlgebraProviderTests\Double\" />
<Folder Include="LinearAlgebraProviderTests\Single\" />
</ItemGroup>
</Project> </Project>
Loading…
Cancel
Save