Boost logo

Boost :

From: boost (boost_at_[hidden])
Date: 2001-12-06 05:51:28


Salut,

On Thursday 06 December 2001 10:45, Toon Knapen wrote:

> >>For instance if I
> >>need a temporary matrix in a loop, but in every loop the total size
> >>of the matrix can be different, I can allocate a matrix with some
> >>maximal size and resize it in every loop to something smaller in every
> >>loop in constant amortised time ?
> >
> > Currently not, but it should be possible to change this. May be we
> > need to differentiate size() and capacity()?
>
> Definitly. This would minimise memory allocation !

I also need this feature to avoid unneccessary allocation,
but here should be the possiblilty to finally release unneeded memory.

What about the following idea:
-> resize( n1, n2) garanties "to hold size1 rows of size2 elements".
-> reserve(n3, n4) garanties that as long n3>=n1, n4 >=n2 no allocations in
resize(n1,n2) are performed. if n3<n1 or n4 < n2 the matrix is allowed to
shrink to the reserved size if requested in a subsequent resize(..) in
order to minimize wasted memory.
But this would lead to the notion of a minimal_capacity().

> > This shall be our small secret ;-) But it's certainly a tribute to
> > these Fortran guys :-)
>
> I can imagine. The leading `u` intrigues me though.
>

At first I thought of some kind of micro-BLAS. looking at the sources /
functionality I guess it stands for universal BLAS,
thinking on your comments i think it stands for underground BLAS :).

Best wishes,
Peter


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk