ILNumerics  >  Support  >  Documentation  >  Getting Started
 

ILNumerics Quick Start Guide

1. Selecting the Binary Distribution

After downloading the ILNumerics binary distribution, extract all files into a folder on your harddisk. The deploy package of ILNumerics has the following file structure:


bin32
  |- ILNumerics32.dll
  |- ILNumerics32.xml
  |- libiomp5md.dll
  |- mkl_custom32.dll
bin64
  |- ILNumerics64.dll
  |- ILNumerics64.xml
  |- libiomp5md.dll
  |- mkl_custom64.dll
doc
  |- changlog.txt
  |- ILNumerics.chm
examples
  |- (...)

The binary files are devided into 32 bit and 64 bit parts. If your project targets x86 (32 bit applications), choose the bin32 folder. For projects targeting x64 (64 bit applications), choose the bin64 folder. Note, the 'Any CPU' target is not allowed in ILNumerics, since the executing mode must match the type of the native binaries involved.

2. Installing the License File

Most examples of ILNumerics can be executed out of the box. This corresponds to a Free Trial License, which is implicitly included in every binary release. However, for serious computations, you will need an evaluation license (valid for 30 days) or a Single User License.

The license file needs to be found by the application at runtime. Several standard ways exist to make this sure:

  • Place the license file in the same folder with your application executable. If using ILNumerics within Visual Studio, this will mostly be the \Debug and the \Release folders of your application project.
  • Or, include the license file as an Existing Item into your project. In the properties of the item (by key 'F4') make sure the file is copied to the output directory.

3. Referencing ILNumerics Binaries

ILNumerics is assembled out of a collection of DLLs. Next to the main managed library ILNumericsXX.dll a number of unmanaged binary files exist. Make sure, all files from the corresponding binary folder of the ILNumerics distribution package are accessible by your application at runtime. We describe the most common way here, utilizing Visual Studio 2010. However, other ways may be more appropriate for your build process.

a) Reference the managed library ILNumerics32.dll or ILNumerics64.dll according to your target platform:

b) Add all files from the same ILNumerics distribution folder, which are not named ILNumerics?? as existing items to your project:

c) In the Solution Explorer, select these files afterwards and open the properties dialog for them (F4). Make sure, 'Copy to Output Dir' is set to 'Copy Always':

4. Referencing ILNumerics Namespaces

The core functionality of ILNumerics is imported by the following directive:

C# Code
1
using ILNumerics;           
Visual Basic Code
1
Imports ILNumerics;         


Hello ILNumerics!

The following code snippet demonstrates, how a simple equation system is solved via ILNumerics. It is based on a new console application. Replace the auto generated ConsoleApplication1 class with the following code. Make sure to copy and reference needed binaries as described above!

C# Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ILNumerics; 
 
namespace ConsoleApplication1 {
 
    // it is recommended to derive from ILMath
    class Program : ILNumerics.ILMath {
 
        static void Main(string[] args) {
            // create a matrix A, give values explicitely
            ILArray<double> A = array<double>(
                    new double[]{1,1,1,1,1,2,3,4,1,3,6,10,1,4,10,20},4,4);
            // use a creation function for B
            ILArray<double> B = counter(4,2); 
            
            // use a function of the base class: ILMath.linsolve 
            ILArray<double> Result = linsolve(A,B);
 
            // A.ToString() gives formated output
            Console.Out.WriteLine("A: " + Environment.NewLine + A.ToString());
            Console.Out.WriteLine("B: " + Environment.NewLine + B.ToString());
            Console.Out.WriteLine("A * [Result] = B: " + Environment.NewLine 
                                                       + Result.ToString()); 
 
            // check result:
            // uses norm, multiply, eps and binary operators 
            if (norm(multiply(A, Result) - B) <= eps) {
                Console.Out.WriteLine("Result ok");
            } else {
                Console.Out.WriteLine("Result false");
            }
            Console.ReadKey(); 
        }
    }
}

The program generates the following output:

C# Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
A:
<Double> [4,4]
         1          1          1          1
         1          2          3          4
         1          3          6         10
         1          4         10         20
         
B:
<Double> [4,2]
         1          5
         2          6
         3          7
         4          8
         
A * [Result] = B:
<Double> [4,2]
         0          4
         1          1
         0          0
         0          0
Result ok
 

Important Rules at a Glance

Just to get started, the following hints may be of interest:

  • Local array variables are mostly of type ILArray<double>, but any type is allowed as generic argument.
  • Make sure to define the variable type explicitely. The var keyword of C# is not allowed here!
    C# Code
    1
    2
    3
    4
    5
    
    // Correct: Always give the type of array variables explicitly! 
    ILArray<double> A = rand(10,20);     
     
    // WRONG!! This will fail!
    var A = rand(10,20);     // do not use "var"   

    Similarly, for Visual Basic:

    Visual Basic Code
    1
    2
    3
    4
    5
    
    // Correct: Always give the type of array variables explicitly! 
    Dim A as ILArray (Of Double) = rand(10,20);     
     
    // WRONG!! This will fail!
    Dim A = rand(10,20);     // do not ommit the type of A!
  • Derive your class from ILNumerics.ILMath. That way, all static functions are easily accessible.

In order to get started, visit the online documentation and learn everything about handling arrays in ILNumerics. As soon as it comes to writing your own functions, the General Rules are of importance.

Getting help

The following resources are available for documentation:

Upgrading to a newer version

All upgrades of ILNumerics can be used to replace an older version. All files from the new runtime distribution should overwrite existing files from the older distribution. However, make sure, to keep the following files:

  • Existing ILNumerics license file (ILNumerics.lic)
  • Any of your configuration and other support files you may have added on your own and are needed from within your application.

Please read the individual upgrade instructions carefully! They are contained in every runtime distribution and may contain individual hints for the specific version.