Code walkthru

Jul 13, 2011 at 2:45 PM

Hi everyone,

New member here!  I am going to download the codebase and discuss it a little here. 

Jul 13, 2011 at 5:38 PM

Tutorial on PInvoke

Jul 18, 2011 at 6:46 PM

Chris Smith's book "Programming F#" covers P/Invoke too on page 365-367.

Jul 18, 2011 at 7:02 PM

F# will make calls thru P/Invoke to LAPACK which is written on BLAS which is optimized for the platform.

Jul 18, 2011 at 8:11 PM


lapack_base.fs is the main user Application Program Interface (API).  It uses F# Power Pack's Microsoft.FSharp.Math matrix and vector extensively. 

The lapack_bas.fs API wraps the existing LAPACK API, but how completely I am not sure.  Let's answer that question here.

LAPACK divides its functions into three types: drivers, computational, auxilary.

LAPACK handles 4 types of data primitives :


But lapack_base.fs seems to ignore all but double.  Thus all the functions begin with "d".  It seems that complex numbers are not handled by lapack_base.  Microsoft.FSharp.Math.Complex exists, so MathProvider could handle complex someday.

LAPACK handles these types of matrices:

BD bidiagonal
DI diagonal
GB general band
GE general (i.e., unsymmetric, in some cases rectangular)
GG general matrices, generalized problem (i.e., a pair of general matrices)
GT general tridiagonal
HB (complex) Hermitian band
HE (complex) Hermitian
HG upper Hessenberg matrix, generalized problem (i.e a Hessenberg and a
  triangular matrix)
HP (complex) Hermitian, packed storage
HS upper Hessenberg
OP (real) orthogonal, packed storage
OR (real) orthogonal
PB symmetric or Hermitian positive definite band
PO symmetric or Hermitian positive definite
PP symmetric or Hermitian positive definite, packed storage
PT symmetric or Hermitian positive definite tridiagonal
SB (real) symmetric band
SP symmetric, packed storage
ST (real) symmetric tridiagonal
SY symmetric
TB triangular band
TG triangular matrices, generalized problem (i.e., a pair of triangular matrices)
TP triangular, packed storage
TR triangular (or in some cases quasi-triangular)
TZ trapezoidal
UN (complex) unitary
UP (complex) unitary, packed storage

lapack_base.fs exposes the following subset: GE,PO,TR,SY,GG

Let's look at the drivers (high level functions).  LAPACK has these:

Linear Equations Driver

     SV  Simple

    SVX Expert

lapack_base.fs exposes: SV

Least Squares Driver

    LS Least Squares

    LSE Least Squares Equality-constrained

    GLM General Linear Model

lapack_base.fs exposes: LS, LSE

EigenValue/Vector Driver

    EV Computes eigenvalues and eigenvalues simply

    EVX Computes eigenvectors and eigenvalues expertly

    EVD Divide and conquer

    EVR Relatively Robust Representation

    ES Schur factorization

lapack_base.fs exposes EV

Singular Value Decomposition

    SVD Simple Singular Value Decomposition

    SDD Improved SVD

lapack_base.fs exposes: SVD, SDD

There are a few more areas to cover, but...

To conclude: lapack_base.fs exposes about one-half of the calls of LAPACK (no doubt the most important ones!).