Industrial Data Science
in C# and .NET:
Simple. Fast. Reliable.
 
 

ILNumerics - Technical Computing

Modern High Performance Tools for Technical

Computing and Visualization in Industry and Science

tgt

Creating a Computing Module

 

Algorithms in ILNumerics are easily created based on the ILNumerics Computing Engine. You can start by adding a preinstalled item template (.NET Framework only) or you can setup your project manually.

Setup your Project manually

References

1. Add the ILNumerics references. ILNumerics.Computing and ILNumerics.Core are required. ILNumerics.numpy is recommended. .NET Framwork projects add references from the GAC (Visual Studio Solution Explorer -> Add Reference Dialog -> Assemblies -> Extensions). .NET Core projects add the references from the ILNumerics installation folder (/bin subfolder).

2. .NET Core projects only: add the nuget package: Microsoft.Windows.Compatibility.

This short video demonstrates the required steps:

 

Add Code

Follow the steps in the next video tutorial, in order to write your first ILNumerics algorithm:

 

 

Like these videos? Here is a more advanced introduction on some debugging features of ILNumerics:

 

 

Computing Module Item Template (Full .NET Framework only)

Alternatively to the manual setup you can start your computing algorithm in Visual Studio for any C# based project based on a preinstalled item template (full .NET Framework only). Right click on the project in the solution explorer and choose the ADD NEW ITEM dialog. (Make sure to right-click on the project node! The template will not show in the ADD NEW ITEM list when trying to add a solution item!)

 

Computing Module by ILNumerics

 

Select the Computing Module item template from the list and confirm by pressing "Add".

 

Add Computing Modul ILNumerics

 

This will add references to the ILNumerics assemblies to your project and add a new Computing Module class which you can use as a starting point for your own algorithm implementations.

The Computing Module implements a class with two methods – solely for demonstration purpose:

  • SimpleMethod - an ILNumerics method with two array input parameters and one array return value
  • MethodWithOutputParameters - showing the use of output parameters in ILNumerics

You can start implementing your own algorithm inside the method bodies, change the methods freely or replace them with your own functions.

Starting with a Computing Module item template is a fast and easy way of writing your own algorithms with ILNumerics. However, you do not have to use the Computing Module in order to use ILNumerics in your code! If you want to start without a template, you can simply add a reference to the ILNumerics assemblies (ILNumerics.Core, ILNumerics.Computing, ILNumerics.IO.HDF5, ILNumerics.Toolboxes.Optimization etc.) to your project manually - as shown above. In the Solution Explorer right click on the References node of your project, select 'Assemblies' and choose the 'Extensions' tab. Now filter for the assembly name: 'ILNumerics'.

 

Reference Manager ILNumerics

Visit the online documentation in order to learn how to write algorithms with ILNumerics.

 

In order to run the computing module, let your project know, where to start with. Double click on the Properties node in the Solution Explorer and select 'Computing_Module1' as Startup Object in the project settings:

 

Console Application ILNumerics

 

As one example of a simple algorihm in ILNumerics, we can invert a matrix. Replace the body of the SimpleMethod() with the following code:

We can call that SimpleMethod from the Main function of the Computing Module:

This will print the first five elements from the first five rows of the inverse to the console:

Visit the online documentation in order to learn how to write algorithms in ILNumerics.

Important Rules at a Glance

Local array variables are mostly of type Array<double>, Array<float> ...

Make sure to define the array variable type explicitely! The var keyword in C# is not allowed to declare array variables!

Similarly, for Visual Basic:

Import the static ILNumerics.ILMath class by adding 'using static ILNumerics.ILMath' at the top of your computational code files. That way, all static functions are easily accessible.

Visit the online documentation and learn everything about handling arrays in ILNumerics.

Further reading: Computing Engine Documentation.

ILNumerics® Quick Reference Charts

Array Usage (Download PDF): 

ILNumerics ArraysUsage

Writing Functions with ILNumerics - Example 

 

ILNumerics for Matlab Users (Download PDF)ILNumerics for Matlab Users

For a quick basic introduction into ILNumerics Computing Engine go here. Or learn everything in the online documentation.