/// <summary>Initializes a new instance of the <see cref="BlasNativeWrapper" /> class. /// </summary> public BlasNativeWrapper() { m_Name = new IdentifierString("BLAS"); m_Level1 = new Level1BLAS(); m_Level2 = new Level2BLAS(); m_Level3 = new Level3BLAS(); }
/// <summary>Initializes a new instance of the <see cref="BlasNativeWrapper" /> class. /// </summary> /// <param name="name">The name of the Library.</param> /// <param name="level1">The implementation of level 1 BLAS functions.</param> /// <param name="level2">The implementation of level 2 BLAS functions.</param> /// <param name="level3">The implementation of level 3 BLAS functions.</param> protected BlasNativeWrapper(IdentifierString name, ILevel1BLAS level1, ILevel2BLAS level2, ILevel3BLAS level3) { m_Name = name ?? throw new ArgumentNullException(nameof(name)); m_Level1 = level1 ?? throw new ArgumentNullException(nameof(level1)); m_Level2 = level2 ?? throw new ArgumentNullException(nameof(level2)); m_Level3 = level3 ?? throw new ArgumentNullException(nameof(level3)); }
/// <summary>Initializes a new instance of the <see cref="CBlasNativeWrapper" /> class. /// </summary> public CBlasNativeWrapper() { m_Name = new IdentifierString("CBLAS"); m_Level1 = new Level1CBLAS(); m_Level2 = new Level2CBLAS(); m_Level3 = new Level3CBLAS(); }
/// <summary>Initializes the <see cref="BLAS"/> class. /// </summary> /// <remarks>This constructor takes into account the Managed Extensibility Framework (MEF) with respect to <see cref="LowLevelMathConfiguration"/>.</remarks> static BLAS() { ILibrary blas = null; try { blas = LowLevelMathConfiguration.BLAS.CreateFromConfigurationFile(); if (blas == null) { blas = LowLevelMathConfiguration.BLAS.Libraries.BuildIn; Logger.Stream.LogError(LowLevelMathConfigurationResources.LogFileMessageConfigFileUseDefaultImplementation, "BLAS"); } } catch (Exception e) { /* thrown of Exceptions in static constructors should be avoided: */ Logger.Stream.LogError(e, LowLevelMathConfigurationResources.LogFileMessageCorruptConfigFile); blas = LowLevelMathConfiguration.BLAS.Libraries.BuildIn; Logger.Stream.LogError(String.Format(LowLevelMathConfigurationResources.LogFileMessageConfigFileUseDefaultImplementation, "BLAS")); } Level1 = blas.Level1; Level2 = blas.Level2; Level3 = blas.Level3; }
/// <summary>Initializes a new instance of the <see cref="CBlasNativeWrapper" /> class. /// </summary> /// <param name="name">The name of the Library.</param> /// <param name="level1">The implementation of level 1 BLAS functions.</param> /// <param name="level2">The implementation of level 2 BLAS functions.</param> /// <param name="level3">The implementation of level 3 BLAS functions.</param> protected CBlasNativeWrapper(IdentifierString name, ILevel1BLAS level1, ILevel2BLAS level2, ILevel3BLAS level3) { if (name == null) { throw new ArgumentNullException("name"); } m_Name = name; if (level1 == null) { throw new ArgumentNullException("level1"); } m_Level1 = level1; if (level2 == null) { throw new ArgumentNullException("level2"); } m_Level2 = level2; if (level3 == null) { throw new ArgumentNullException("level3"); } m_Level3 = level3; }
/// <summary>Computes the square of the Euclidean norm of a specific vector, i.e. ||x||^2. /// </summary> /// <param name="level1">The BLAS level 1 implementation.</param> /// <param name="n">The number of elements of <paramref name="x"/>.</param> /// <param name="x">The vector 'x' with at least <paramref name="n"/> elements.</param> /// <param name="incX">The increment for <paramref name="x"/>.</param> /// <returns>The square of the euclidian norm of x, i.e. x_0^2 + ... + x_n^2.</returns> public static double dnrm2sq(this ILevel1BLAS level1, int n, double[] x, int incX = 1) { var norm = level1.dnrm2(n, x, incX); return(norm * norm); }
/// <summary>Initializes a new instance of the <see cref="Level1BLASTests"/> class. /// </summary> protected Level1BLASTests() { m_Level1BLAS = GetLevel1BLAS(); }