Boost logo

Ublas :

From: Dima Sorkin (dsorkin_at_[hidden])
Date: 2005-12-15 06:36:58


Quoting Riccardo Rossi :
> i want to preallocate on my own the matrix A and to be sure not to modify its
> sparsity in processing it...
> in other words i would like to get an error when i try to access an index
> that does not exist

It seems that uBLAS is not fitted for this purpose as is.
You would have to write your own wrapper.
Sparse matrix of Deal.II lib does such thing:
http://www.dealii.org/5.2.0/doxygen/lac/classSparseMatrix.html
but it's use isn't as simple (for the first time).

> the code i wrote is attached ... but it feels free of allocating dynamically
> new memory if needed

1) You didn't provided the types of variables
that participate in your code.
2) You still can assemble fem matrices in very effective way,with uBLAS
(with very low memory allocation penalty). Please see :
http://www.bauv.unibw-muenchen.de/~winkler/ublas/tuc/ublas/matrix_sparse_usage.html#Q3

I personally like to assemble into coordinate_matrix, then copy
the values into compressed_matrix.

Regards,
 Dima.