PackageDescription: Smallapack
SmallapackLast published: February 3, 2012 by 'nice'
Defines 26 Classes
Extends 35 Classes
Smallapack is a Smalltalk interface to BLAS/LAPACK
It handles Matrix algebra based on well known numerical optimized external library available at [http://www.netlib.org].
More information on Smallapack can be found at [http://code.google.com/p/smallapack].
Smallapack handles the following class of matrices:
- single/double precision floating point matrices.
- single/double precision complex matrices.
- properties: General/Hermitian/Symmetric/Triangular
use optimized BLAS/LAPACK according to.
The aim of Smallapack is to make a plug-and-play linear algebra package available to Smalltalk users,
and to promote the use of Smalltalk for engineering purposes.
Smallapack is thus distributed freely (see the liberal MIT LICENSE below).
Smallapack is developped under visualworks non commercial version 7.
It should work painlessly down to visualworks 2.5 since based on DLLCC (not tested).
Other dialects will require porting.
Smallapack Matrices implement following methods
- arithmetic: + - * / \ negated reciprocal
- extraction: access a row, a column, diagonal, a sub-diagonal, a super diagonal, upper triangle, lower triangle etc..
- concatenation: append columns with #, and append rows with #,,
- decomposition: eigenValues svd lu qr Schur Hessenberg
In order to ease inter-operation, Smallapack implements some compatibility protocol:
- with 'Numerical Methods'
- with Smallpack
- with Squeak.Matrix
A Smallapack page will appear in VisualWorksSettings for setting external library files and directories.
It is based on 7.2 VisualWorksSettings, not on older UISettings.
On older images, library path and files will have to be set manually in a Browser...
LAPACK and BLAS library should be compiled as dynamic link library
Smallapack expects a trailing underscore appended to each function name due to FORTRAN
It also expects additional trailing integer arguments for each character argument passed.
(most Unix compiler do that by default, some Win32 can do with appropriate flags).
Without FORTRAN compiler, it is possible to use f2c.
TODO and OPEN QUESTIONS:
A lazy evaluation version would be more clever and efficient (in the spirit of excellent C++ ublas library found in Boost).
Add more Matrix properties: Band Packed Tridiagonal...
Cannot assign a class for each combination (Tridiagonal symmetric etc...)
Full double dispatching implementation is not used (un-manageable volume of code).
A more appropriate coercing scheme is used (based on bitOr'ing some flags...)
SparseMatrix extensions would be welcome (optimized external library...).
Unfortunately, this is not part of Lapack.
Add more LAPACK algebra (qz, cholesky, least squares, new divide and conquer algorithms...).
Solve classical equations (Riccati Lyapounov Sylvester etc...).
Pure Smalltalk implementation is to be completed also (in AbstractMatrix or a subclass).
CBlasLibrary, BlasLibrary and LapackLibrary are subclassed for dispatching according to precision and real/complex-ness.
There is a problem of duplicating library path and files in each subclass (necessary for fully optimized external library).
ExternalInterface code is not well factored yet. Should be more clever... (but remember efficiency is a primary goal of Smallapack).
Generalized access "a la Matlab" is still to be developped... A( 1:n , 1:m ) = B...
Triple dispatching (yes, two indices) would be quite boring...
Could also be quadruple if one considers the right hand sides A( 1:n , 1:m ) = 0, A(1:m , 1:n) = [], ...
Solution also lie in lazy evaluation, but it's challenging.
Matlab and F95 Matrix+Number operations are implemented. From math. point of view, this is questionnable.
In Smalltalk, this is simply a collect: operation... But the short form Matrix+Number is so much widespreaded...
However, the element-wise max: min: quo: rem: // \\ are not implemented yet.
Nor are element-wise * / ** (the .* and ./ and .^ of Matlab)
Matlab compatible Matrix interpreter should be implemented, at least for writing tests.
LAPACK can also generate random matrices (interesting for Tests).
Before being stored in binary format (BOSS), Matrices should be stored in Smalltalk Space.
LICENSE: (MIT) see copyright information