Provide means to efficiently set up sparse matrices with unknown sparsity structure

Issue #46 new
Klaus Iglberger created an issue

Description

The CompressedMatrix class template provides the interface for a very efficient setup of sparse matrices with known sparsity structure:

blaze::CompressedMatrix<int> M1( 3UL, 5UL );
M1.reserve( 3 );       // Reserving enough space for 3 non-zero elements
M1.append( 0, 1, 1 );  // Appending the value 1 in row 0 with column index 1
M1.finalize( 0 );      // Finalizing row 0
M1.append( 1, 1, 2 );  // Appending the value 2 in row 1 with column index 1
M1.finalize( 1 );      // Finalizing row 1
M1.append( 2, 0, 3 );  // Appending the value 3 in row 2 with column index 0
M1.finalize( 2 );      // Finalizing row 2

However, so far Blaze unfortunately doesn't provide means to efficiently set up sparse matrices with unknown sparsity structure, as for instance the setup of stiffness matrices in FEM applications. Blaze should provide an interface that enables users to efficiently setup sparse matrices without the need to manually determine the sparsity structure.

Conceptual Example

A possible approach is an Inserter class template, similar to the inserter of the MTL4 library:

template< typename T >
void init( blaze::CompressedMatrix<T> mat )
{
   blaze::Inserter< blaze::CompressedMatrix<T> > ins;

   // ...
   ins(i,j) = value;  // Add the (i,j,value) triple to the inserter
   // ...

   mat = ins;  // Set up the sparse matrix by means of all added triples
}

Tasks

  • provide an interface for the efficient setup of sparse matrices with unknown sparsity structure
  • guarantee correctness and robustness of the sparse matrix setup process
  • ensure compatibility with all existing sparse matrix classes
  • guarantee an efficient setup for common use cases (as for instance the setup of stiffness matrices)
  • provide proper documentation for the interface
  • add the necessary number of test cases for the functionality

Comments (0)

  1. Log in to comment