Source code

From ILNumerics.Net software wiki

Jump to: navigation, search

Contents

Source code for ILNumerics.Net

This page helps you get the source code projects up and running quickly in order to compile assemblies on your own.

Overview

Once you download the sources for ILNumerics.Net you will find the following folders. Each folder has a project associated to it:

  1. ILNumerics - ILNumerics.Net core modules. Main Package. Needed.
  2. ILNumericsTest - needed only for checking integrity of the core packages. Not neccessarily needed.
  3. ILCPUID - determines properties of proccessor on runtime. Mostly not needed (see below).
  4. Hycalper - source code replication tool. Needed only for specific situations (see below).
  5. bin - folder. Contains no project, but all native binaries, chm documentation, license files and build wrapper. Needed.

All projects are included into a Visual Studio 2005 solution: ILNumerics.Net.sln, which is also provided in the root directory of the downloaded zip package. The solution bundles the following projects: ILNumerics.Net, ILNumericsTest, ILCPUID.

Building ILNumerics.Net using Microsoft® Visual Studio 2005 (recommended)

No special configuration is nesseccary here. The solution should open and build all 3 projects without errors. Generated assemblies are placed into the bin folder, next to all dependencies. Therefore you should be able to run ILNumericsTest.exe. It should complete without errors (Attention: the tests are a little time / memory consuming...!)

Building ILNumerics.Net without using solution file

  • Redirect the output folder for
    • ILNumerics.Net.dll, ILCPUID.dll and ILNumericsTest.exe, as well as
    • the corresponding xml intellisense documentation file: ILNumerics.Net.xml,
into the 'bin' folder. This action is to make sure, all binaries are available on runtime. Alternatively you may choose to copy all runtime binaries into your custom output folder to archive the same result. A list of all files may needed at runtime is found in the textfile 'runtime.txt'.

For compilers which are not capable of reading the project files, you would have to create makefiles for your build environment instead. Not surprisingly all source code is found in its corresponding folder. Consult the documentation for your compiler on how to point onto those files.

Modifying sources

ILNumerics.Net is mainly written in C#. In general there is no special care to be taken if you wish to modify source code for ILNumerics.Net. However, in order to increase error robustness and source maintainability, ILNumerics.Net utilizes the Hycalper code generation tool. This tool is used for partial and repeated replication of source code - mainly to replicate source code segments formulated of one parameter type for all other types supported.

For example a function receiving a parameter of type ILNumerics.ILArray<double> could be formulated explicitly and than replicated for corresponding overloads receiving ILArray<float>,ILArray<complex>,ILArray<int>,etc... Those sections are marked with special source code tags:

  1. #region HYCALPER LOOPSTART
  2. // everything in here is going to be replicated
  3. function ILArray<double> thefunctionname (ILArray<double> A) {
  4. // ... function code handling ILArray<double> parameter
  5. }
  6. #endregion HYCALPER LOOPEND
  7. #region HYCALPER AUTO GENERATED CODE
  8. // everything inside this section was generated
  9. // by the HYCALPER tool.
  10. #endregion HYCALPER AUTO GENERATED CODE

The Hycalper tool uses special code comment tags to identify the patterns in the original sequence to be replaced in replicated sequences. It takes one sequence of (valid) source code, replaces all occourences of predefined pattern with its substitutes and replicates & add the result to the source file. Therefore the source file will always contain valid source code and can get compiled and debugged just like normal source files.

Developers should have the following points in mind:

  • All edits outside of regions marked with HYCALPER can be made without special care.
  • For edits inside those regions, developers should
    • read and understand the documentation for Hycalper and utilize the Hycalper replication tool (recommended).
    • Alternatively, she could remove the enclosing HYCALPER tags from the code section. By doing so, she must be aware that all changes to a part of the code will not automatically distributed to corresponding sections formerly covered from the Hycalper tool anymore. Once the Hycalper support is removed, the developer must maintain all those sections individually (which usually leads to bugs and is therefore not recommended). In addition to this, all code contributed back to ILNumerics.Net for inclusion in the official development tree, must utilize the HYCALPER build tool.

Utilizing Hycalper

In oder to utilize the Hycalper replication tool, Hycalper's binary must be build from its sources first. A dedicated project is included into the source package for it. It's output assembly is than to be placed into the ILNumerics.Net binary bin folder. A little script called hycalper ILNumerics.bat from the bin folder can be started than. It will browse the directory structure and do all replacements neccessary.

Note: Hycalper will only run, if started manually this way. Currently the tool is not integrated into the build process of the Visual Studio 2005® solution file. It's up to you to do so, if you see any advantage.

Contributions

If you found and /or fixed a bug, added a useful feature or worked around a limitation - please contribute your source code back to the ILNumerics.Net support team! ILNumerics.Net is always seeking for interested people helping to maintain and extend the library. For any of those requests, contact us at: info@ilnumerics.net

Your support is highly appreciated!

Personal tools