# ABLAS Library

This document describes the ABLAS library — a lightweight basic linear algebra subroutines library with SSE2 support. The ABLAS library is used by programs that are parts of ALGLIB project to speed up the linear algebra algorithms. At the moment only C++ version of ALGLIB can use ABLAS. However, in the future it is planned to add ABLAS into ALGLIB versions based on other languages.

# The language, the compiler and the OS

The library is written on Pascal. The compiler used - FreePascal (version 2.2.0 was used for compiling). Current library version supports only Win32.

# Distribution and licensing

The ABLAS library is distributed under BSD license. It is distributed as precompiled binary files and as source code. These files may be downloaded from ABLAS page: http://www.alglib.net/projects/ablas/ (or http://alglib.sources.ru/projects/ablas/ in Russian).

# Features

The library supports vector operations with double precision real numbers. Their elements should be allocated in memory sequentially with no spaces between them. Such vectors correspond to one-dimensional arrays and rows in 2D arrays in most high-level languages. The following operations are available:

- scalar product - subroutine `ASMDotProduct1`
- copying - subroutine `ASMMove1`
- copying and multiplying by a scalar - subroutine `ASMMoveS1`
- copying and multiplying by -1 - subroutine `ASMMoveNeg1`
- adding a vector - subroutine `ASMAdd1`
- adding vector and multiplying the added vector by number - subroutine `ASMAddS1`
- subtracting vector - subroutine `ASMSub1`
- inplace-multiplying the vector by number - subroutine `ASMMulS1`

Each operation allows the following implementation types, chosen automatically depending on the processor and operands:

- Fully aligned SSE2 implementation. It is used if both operands are aligned on a 64-bit boundary (which is equivalent to alignment on a 128-bit boundary after data preprocessing). This implementation provides maximum speed.
- Partially aligned SSE implementation. It is used if only one operand is aligned on a 64-bit boundary. This implementation is slower than the previous one.
- FPU implementation - it is used if none of the operands is aligned on a 64-bit boundary or CPU does not support SSE2.

# Using ABLAS in C++

To be able to use ABLAS programs with ALGLIB library, two actions are required. First, set in the compiler options (or define with the `define` directive) the `AP_WIN32` symbol. This symbol notifies the ALGLIB package that it is working under Windows and can use the corresponding operating system functions to find and load additional libraries. Second, put the library file (`ablas.dll`) in the same directory as your program executable. After these two steps the library will be detected and loaded automatically.

# Using ABLAS in other programming languages

At the moment there are no ABLAS interfaces for other programming languages.