Boost logo

Boost Users :

From: Hicham Mouline (hicham_at_[hidden])
Date: 2008-05-28 14:19:12


Hello,

 

I have an algorithm that interpolates a value out of tabulated data.

Performance tests show that using

 

double algo( const double* data [2], int datasize, double x)

 

is faster than

 

double algo( const std::vector<double>&, const std::vector<double>&, double
x)

and

double algo( const boost::multi_array<double, 2>&, double x)

 

by 30% or so.

 

 

So I chose the first one.

 

 

However, I have a requirement to add points to the tabulated data
dynamically.

For this, the best container would have been std::map<double, double> with

which insertion is part of map's interface.

However, the algorithm requires _random_ iterators to the container to
proceed,

so map doesn't workout but vector and multi_array do.

 

What would be the best compromise?

 

Regards,



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net