ILNumerics - Technical Computing Tools

High Performance Framework for Visualization

and Computing in Industry and Science

 

tgt

Creating a Computing Module

Algorithms in ILNumerics are easily created based on an ILNumerics Computing Module. Computing Modules are easily created in Visual Studio for any C# based project. 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 the fastest and easiest 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. 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' or 'HDF5'...

 

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 ILArray<double>, ILArray<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:

Derive your class from ILNumerics.ILMath. That way, all static functions are easily accessible.

Visit the online documentation and learn everything about Handling Arrays in ILNumerics. As soon as it comes to writing your own functions, General Rules are of importance for best performance results.

Further reading: Computing Engine Documentation.

ILNumerics® Quick Reference Charts

Array Usage (Download PDF): 

ILNumerics ArraysUsage

Writing Functions (Download PDF)

Code Example ILNumerics

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

A short introduction showing the general usage of an ILNumerics Computing Module: