Boost logo

Ublas :

From: Georg Baum (Georg.Baum_at_[hidden])
Date: 2006-01-31 03:10:22

Am Dienstag, 31. Januar 2006 04:23 schrieb David M Garza:
> I'm working with a numerical optimizer designed for large, sparse
> problems and written in Fortran. When the the optimizer calls back for
> a Jacobian evaluation it passes the array where it expects the Jacobian
> values to be placed. Is there a simple way to build a uBLAS sparse
> matrix object which simply wraps this array? My first thought is no,
> but my second thought is "I could make a custom allocator..." Has
> someone already tackled this problem? I expect this array to be big
> (10,000-100,000 elements) so I'd like to avoid just copying it.

As long as the structure of the sparse array is compatible to one of the
ublas sparse types (e. g. compressed_matrix or coordinate_matrix) it should
be possible to do that with shallow_adaptor. Search the archives, this has
been discussed before for dense matrices, but I see no reason why it should
not work for sparse types, too.
You could also have a look at the umfpack bindings in boost sandbox cvs,
they also interface sparse types with fortran.