Monday, 1 July 2013

Sparse matrix multiplication using SQL

a and b are two sparse matrices. We want to perform a * b as shown below:

Sparse matrix multiplication using SQL
We can represent a sparse matrix in a relational database as a table matrix_name(row_num, col_num, value). Each non-zero cell in the matrix is represnted as a record (i, j, value) in the table.