Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-06-22 04:37:52


Hello Srini,

On Tuesday 21 June 2005 04:41, VTK FAN wrote:
> Hello, I was wondering if anyone could help me with
> this issue. I am investigating using uBLAS as the
> basis of container classes for solving partial
> differential equations. I have a discretized mesh and
> solution vectors associated with the mesh which I
> would like to store and also make use of BLAS like
> operations for computing sums, norms, axpy ops,
> transforms, scaling, slicing etc, and also be able to
> allocate, grow, shrink and destroy these solution
> vectors during runtime.
>
> The uBLAS interface to ATLAS also interested me. How
> easy is it to deallocate and grow/shrink uBLAS
> vectors?

You can resize uBLAS 'vector' and matrix containers. With the default storage
type 'unbounded_array' you can make arbitrary changes. Fix size storage types
are restricted within the maximum size.

> I could not find anything on the
> Documentation page as many links seem to be broken.
This is annoying. I assume the broken links are in the version on the Boost
web site. This now seems to be a mixture of the documentation for the
Boost_1_32_0 release and more recent updates.

You should get consistent documentation in the download Boost_1_32_0 release
files or the coming Boost_1_33_0 release which is the HEAD of the Boost CVS.

> Is
> there a big memory penalty as compared to STL's vector
> class or regular C arrays?

uBLAS 'vector' stores the current size in addition to the data. If you use the
default 'unbounded_array' storage type then a second size is also stored.

> Would the c_vector and
> c_matrix classes have any restrictions on use compared
> to other uBLAS containers?
You cannot resize them above the fixed size.

> Is uBLAS being actively developed and will it be
> maintained for the next few years?

I guess the best answer is the activity on the mailing list. Big changes may
no be forcoming quickly but uBLAS is certainly maintained. Slow but
worthwhile progress has been made on the documentation recently.

> And one dumb
> question, if I allocate a c_vector using new, how do I
> delete it without any memory leaks? For example can I
> do:
>
> namespace mySolver = boost::numeric::ublas
>
> mySolver::c_vector *pressure_vector = new
> mySolver::c_vector(npoints_to_be_read);
>
> ...
> ...
> bunch of solver code
> ...
> ...
> delete pressure_vector;
> pressure_vector = NULL;

Should work as is.

> I want to prevent any leaks and was not sure how to
> allocate/delete pointers to these uBLAS templated
> classes. I was not able to locate any such examples on
> the Web using uBLAS in this fashion.

I guess there are no examples as it simply behaves as any other container!

> Responses would be much appreciated.

No problems. Have fun,
        Michael

-- 
___________________________________
Michael Stevens Systems Engineering
34128 Kassel, Germany
Phone/Fax: +49 561 5218038
Navigation Systems, Estimation  and
                 Bayesian Filtering
    http://bayesclasses.sf.net
___________________________________