Computing Engine - Setup & Rules
This is the first section of the in-depth documentation of ILNumerics Computing Engine. For a quick basic introduction go here.
The following description assumes that ILNumerics is activated on your computer. From version 6 the installation step is skipped and all modules are referenced from nuget.org!
Useful Namespaces and imports
The following directives should be added at the beginning of your code files. They save a bunch of namespace and class specifiers and make your code a lot more readable. Note that our code examples throughout this documentation assume that you have these directives defined (without repeating that boilerplate code). When copying example listings into your app locally you will likely have to add them manually.
...and for Visual Basic:
using static ILNumerics.numpy;
Limitations on C# language features
Before learning the details of what can be done with ILNumerics, let's accept some limitations! The following features of the C# language are not compatible with the array types of ILNumerics and their use is not supported:
- The C#
var keyword in conjunction with any ILNumerics array type, and - Any compound operator, like
+=, -=, /=, *= and so on. To be precise, these operators are not allowed in conjunction with the indexer on arrays. SoA += 1; is allowed.A[0] += 1; is not! If you find this rule too hard to remember, we suggest not to use compound operators at all.
Limitations on Visual Basic language features
The type for all arrays must be defined explicitely. Just like the
Function Rules - Overview
Performance is made out of only three simple rules! They are described in detail in the next section and summarized in the following example function:
Essential function rules of ILNumerics: The first rule declares specific array types for input parameters and return values in function declarations. The second rule creates artificial scopes around the function body and the third rule handles assignments to output parameters.