Boost logo

Boost :

From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-08-16 12:34:22


I've posted a few times to the python-c++ list, but maybe this subject is of
more general interest so I'm posting here.

I'm interested in interfacing c++ algorithms (primarily for signal
processing) with python via boost-python. I'm trying to develop a library
of algorithms, but first the proper infrastructure is needed.
Specifically, a choice of underlying container to be used for passing
vectors between python and c++.

Vector processing is in my view one of the primary interests for
boost-python.  By processing vectors, the overhead involved with python and
the python-c++ interface becomes acceptable.

I believe a suitable container for interfacing between python and c++ is of
fundamental interest to the boost-python community.  I'm sure there must be
a lot of interest in this subject.

I have tried to investigate 3 candidates.

1) std::vector
2) ublas
3) numarray

So far the results are:

1) std::vector -
pros:
universal availability
easily understood
supports required operations (insert, erase...)
vector_indexing_suite already implemented (could be optimized more)

cons:
lacks vector arithmetic - but I just implemented this and it isn't difficult
even for an amateur like myself

2) ublas:
pros:
already has vector arithmetic

cons:
lacks required operations (e.g., erase)
no indexing_suite (see above)

3) numarray
pros: ?

cons:
I had a hard time finding documentation.
Heavy-weight interface -> high learning curve

Summary:
It appears that std::vector is a good choice.  Ublas might be better in the
future, but at present it lacks some required functionality.  A ublas
vector does not fulfill all the requirements of Sequence.  This topic is
known to ublas developers and may be addressed in the future.

Here is an initial version of vector arithmetic for std::vector:








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