view yetilab/matrix/matrixtype.yeti @ 249:1ea5bf6e76b6 sparse

A reasonable sparse multiply, and a bit quicker dense one
author Chris Cannam
date Mon, 20 May 2013 22:17:19 +0100
parents ccca84efa36a
children 5eb57c649de0
line wrap: on
line source

module yetilab.matrix.matrixtype;

load yetilab.vector.vectortype;

typedef opaque matrix =
    DenseRows. array<vector> | // array of rows
    DenseCols. array<vector> | // array of columns
    SparseCSR. {
        .values is vector,
        .indices is array<number>, // column index of each value
        .pointers is array<number>, // offset of first value in each row
        .extent is number // max possible index + 1, i.e. number of columns
        } |
    SparseCSC. {
        .values is vector,
        .indices is array<number>, // row index of each value
        .pointers is array<number>, // offset of first value in each column
        .extent is number // max pointers index + 1, i.e. number of rows
        };

();