Dodoni.MathLibrary.Native.Yeppp

1. Overview

Provides wrapper for Yeppp!, a high-performance SIMD-optimized mathematical library for x86, ARM, and MIPS processors on Windows, Android, Mac OS X, and GNU/Linux systems.

2. Dependencies

This assembly depends on

3. Main concepts and helpful code snippets

The Managed Extensibility Framework (MEF) is used to dynamic link to this assembly. If specific features are needed which are not covered by the generic interface one may add a reference to yeppp-cli.dll which is part of the distribution of Yeppp! One may have a look into the unit test project of Dodoni.MathLibrary.Native.Yeppp; see API documentation for more information.

4. Important remarks


public static void ExtractResource(string outputPath)
{
  var resource = "windows/x86/yeppp.dll";  // "windows/x86_64/yeppp.dll";
   try
   {
    var assembly = Assembly.LoadFrom(@"[Path..]/Yeppp.CLR.Bundle.dll");

     using (Stream resourceStream = assembly.GetManifestResourceStream(resource))
      {
       using (DeflateStream deflateStream = new DeflateStream(resourceStream, CompressionMode.Decompress))
        {
          using (FileStream fileStream = new FileStream(outputPath, FileMode.CreateNew, FileAccess.Write, FileShare.None))
           {
             byte[] buffer = new byte[1048576];
             int bytesRead;
             do
              {
               bytesRead = deflateStream.Read(buffer, 0, buffer.Length);
               if (bytesRead != 0)
                     fileStream.Write(buffer, 0, bytesRead);
               } while (bytesRead != 0);
             }
          }
       }
     }
     catch
     {
      File.Delete(outputPath);
      }
 }