Jive reference manual
Functions
Sparse matrix-matrix and matrix-vector multiplication

A collection of functions for computing sparse matrix-matrix and matrix-vector products. More...

Functions

template<class T >
void jem::numeric::matmul (const Array< T > &r, const SparseMatrix< T > &a, const Array< T > &b)
 Computes the product of a matrix and a column vector. More...
 
template<class T >
Array< T > jem::numeric::matmul (const SparseMatrix< T > &a, const Array< T > &b)
 Returns the product of a matrix and a column vector. More...
 
template<class T >
void jem::numeric::matmul (const Array< T > &r, const Array< T > &a, const SparseMatrix< T > &b)
 Computes the product of a row vector and a matrix. More...
 
template<class T >
Array< T > jem::numeric::matmul (const Array< T > &a, const SparseMatrix< T > &b)
 Returns the product of a row vector and a matrix. More...
 
template<class T >
SparseMatrix< T > jem::numeric::matmul (const SparseMatrix< T > &a, const SparseMatrix< T > &b)
 Returns the product of two sparse matrices. More...
 
template<class T , class F >
SparseMatrix< T > jem::numeric::matmul (const SparseMatrix< T > &a, const SparseMatrix< T > &b, const SparseFilter< T, F > &filter)
 Returns the filtered product of two sparse matrices. More...
 

Detailed Description

#include <jem/numeric/sparse/matmul.h>

This header file exports a set of template functions – all named matmul – that compute the following types of matrix-vector products: the product of a matrix and a column vector; the product of a row vector and a matrix; and the product of two matrices.

Both column and row vectors are represented by one-dimensional Array objects. Matrices are represented by SparseMatrix objects.

The matmul functions come in two flavors: one with a return type and one that have a void return type. The matmul functions that have void return type store their results in their first argument. The other matmul functions, on the other hand, return a new Array or SparseMatrix object containing the computed results. The versions of matmul that store their result in their first argument are faster because they do not have to allocate memory.

Function Documentation

template<class T >
void jem::numeric::matmul ( const Array< T > &  r,
const SparseMatrix< T > &  a,
const Array< T > &  b 
)

Computes the product of the matrix a and the column vector b. The result is stored in the column vector r.

Parameters
r- a column vector that is set to the matrix-vector product of a and b.
a- a sparse matrix.
b- a column vector.
template<class T >
Array<T> jem::numeric::matmul ( const SparseMatrix< T > &  a,
const Array< T > &  b 
)

Returns a column vector containing the product of the matrix a and the column vector b.

Parameters
a- a sparse matrix.
b- a column vector.
Returns
The product of a and b.
template<class T >
void jem::numeric::matmul ( const Array< T > &  r,
const Array< T > &  a,
const SparseMatrix< T > &  b 
)

Computes the product of the row vector a and the matrix b. The result is stored in the row vector r.

Parameters
r- a row vector that is set to the vector-matrix product of a and b.
a- a row vector.
b- a sparse matrix.
template<class T >
Array<T> jem::numeric::matmul ( const Array< T > &  a,
const SparseMatrix< T > &  b 
)

Returns a row vector containing the product of the row vector a and the matrix b.

Parameters
a- a row vector.
b- a matrix.
Returns
The product of a and b.
template<class T >
SparseMatrix<T> jem::numeric::matmul ( const SparseMatrix< T > &  a,
const SparseMatrix< T > &  b 
)

Returns a sparse matrix containing the product of the matrices a and b.

Parameters
a- a sparse matrix.
b- another sparse matrix.
Returns
The product of a and b.
template<class T , class F >
SparseMatrix<T> jem::numeric::matmul ( const SparseMatrix< T > &  a,
const SparseMatrix< T > &  b,
const SparseFilter< T, F > &  filter 
)

Returns a sparse matrix containing the product of the matrices a and b, however, with elements filtered out using the filter object.

Parameters
a- a sparse matrix.
b- another sparse matrix.
filter- a sparse filter object
Returns
The product of a and b.