Native F# API

F# with its powerful operator overloading and mathematical look and feel has allowed us to design API that is perfect for quantitative development. Instead of instantiating classes you can simply use functions,

 

e.g.:

let x = rand [2;3] // creates matrix 2×3 with random numbers
let y = 2.0*x + sqrt(x)

 

F# is strongly typed but usually does not require explicit type declarations.

 

GPU acceleration

If you have Nvidia GPU and free CUDA 4.1 installed on your machine you can easily run the same code on CPU and GPU:
 

open FCore.Numerics
open FCore.Numerics.Math
open FCore.Numerics.Stat
let x = rand [2;3] // creates random matrix in RAM
let y = 2.0*x + sqrt(x) // matrix operations run on CPU

 

open FCore.Numerics
open FCore.Numerics.GpuMath
open FCore.Numerics.GpuStat
let x = rand [2;3] // creates random matrix in GPU memory
let y = 2.0*x + sqrt(x) // matrix operations run on GPU

 

Highly parallel operations, e.g. vector functions are order of magnitude faster on GPU.
 

Multidimensional Dense and 2D Sparse Matrix Support

Using FCore you can create and manipulate dense and sparse matrices. There is full support for matrix indexing and slicing, including linear and boolean indexing, as well as a wide range of matrix functions and operators, e.g.:

 

let x = rand [2;3;4] // 3D matrix of random numbers
let y = x.[0, 0, 0] // return first value
let z = x .* x //multiply elementwise
let u = x.[x .> 0.5] // boolean indexing
let v = x.[0..1, 1..2, 1..3] // slicing

 

Linear Algebra

FCore supports 4 matrix factorizations:
- cholesky
- qr
- lu
- singular value

 

e.g.:

let y = chol(x)
let (l, u, p) = lu(x)

 

For each factorization there is a linear equation solver, e.g.:

let x = qrSolve(A, b) // solves Ax = b

 
There are also 2 direct sparse linear solvers available: lu and chol.
 

Random Number Generation

FCore contains 8 CPU based pseudorandom basic generators including Mersenne Twister and 2 CPU quasirandom: Sobol and Niederreiter. On GPU you get 7 random generators. You can set a generator in code:

RandStream.SetGenerator(BasicRng.R250, 0) //sets seed to zero and generator to R250

 

Once the generator is set you can create numbers from a given distribution. Many discreet and continuous distributions are available, e.g. Poisson:

let x = poissRnd(2.5, [2;3;4]) // lambda = 2.5, returns matrix 2x3x4

 

Summary Statistics

Once you have a random sample you can calculate various summary statistics, e.g.:

 

let x = poissRnd(2.5, [2;3])
let m = mean(x, 0) //calculate mean of each column (along zero dimension)

 

Summary functions operate on multidimensional matrices and take dimension as input parameter.

 

FCore Is Fast

Almost all functions are either implemented in C/C++ or use Intel Math Kernel Library which includes BLAS and LAPACK and is highly optimized for Intel microprocessors. GPU acceleration is using Nvidia CUDA 4.1. Where possible FCore functions are multi-threading ready. You have fine control over multi-threading as you can specify at run time how many threads should be used, e.g.:

 

MatrixOptions.MaxThreadCount <- 2 // subsequent matrix operations will use 2 threads even on 4 CPU machine

 

Virtually No Limit on Matrix Size

FCore can bypass .NET 2GB limit for contiguous memory allocation and gives you access to all your RAM via native heap. For small matrices it might be better to use .NET memory allocation so FCore allows you to specify at run time matrix size above which C++ native memory will be used, e.g.:

 

MatrixOptions.MaxManagedLength <- 1000000

 

If a matrix is stored in native memory it can be deterministically, so without waiting for .NET garbage collection, destroyed with a call to IDisposable.Dispose().

 

Easy to Use with Full Support

If you have used other numerical software packages  you will find FCore API very familiar and easy to use. Most functionality is implemented as standalone functions and there are no complex class hierarchies. Full documentation is provided and any questions sent to support will be answered within 1 business day.

 

Fully Tested

We have 1000s unit tests, 1000 of those are Matlab® tests and are included in installation package so you can run them yourself (Matlab® required). Example test for matrix multiplication:

 

[<Test>]
member this.ShouldMultiplyMatrices() =
// multiply 2 random matrices in Matlab®
let r = app.Execute(“
a = rand(10,20);
b = rand(20,30);
c = a * b;
”)
// get matrices from Matlab
let x = getMatrixFromMatlab(app, “a”)
let y = getMatrixFromMatlab(app, “b”)
let z = getMatrixFromMatlab(app, “c”)
// verify result
z == x * y |> should be True

 

Simple Licensing

You can purchase a site license for your company/organization. The license will allow you to use FCore on unlimited development machines within the company, deploy to any machine internally and integrate with a web service e.g. in the Cloud.