Am Montag 08 März 2010 13:32:22 schrieb Pim Schellart:
> we are working on a project for which it would be extremely useful if
> numpy arrays could be passed as arguments to wrapped C++ methods.
> On the website I cannot find any evidence that this is currently
> supported by Boost Python.
> Is this (or will this be) implemented?
After all the recent discussion, I want to point to yet another (hopefully)
interesting bit of code which I am involved with:
Our "vigra" (computer vision) library now comes with numpy- and BPL-based
python bindings.
In addition to type-safe conversions between C++ and Python(*), this offers a
vigra::MultiArray on the C++ side, which is an n-dimensional array class
template, complete with n-dimensional iterators (using raw pointers for the
innermost dimension to offer the best possible performance for unstrided
arrays) and a lot of algorithms, i.e. pointwise transformation / [possibly
type-coercing] copying / inspection etc.
One particular feature Ulli is proud of is the automatic conversion to
*subclasses* of ndarray, such that we can register and use e.g. 'Volume'
python classes for 3D arrays.
I really want to stress that VIGRA is a very versatile template library which
should be able to work in conjunction with any other libraries and data
structures, i.e. true generic code (usually you don't even need to compile
VIGRA, if you are not interested in an image import/export library). So don't
hesitate to give it a shot even if you are /not/ interested in any of its
array / linalg algorithms. (Actually, the PythonArray template class should
be even useful without boost::python, i.e. I am using it with SIP, too.)
I don't think there will ever be just /one/ single solution for
boost::python+numpy, since everyone seems to have different
requirements/expectations w.r.t. available algorithms, static vs. dynamic
element types etc.
However, I do think that our vigranumpy approach could be very useful for some
of this list's readers.
HTH,
Hans
--- Begin Message ---
Hi everybody,
I just released VIGRA 1.7.0. As usual, it can be downloaded from the VIGRA
homepage at
http://hci.iwr.uni-heidelberg.de/vigra/
Main features of the new version are (see
http://hci.iwr.uni-heidelberg.de/vigra/doc/vigra/CreditsChangelog.html for a
more comprehensive listing):
* vigranumpy: (long awaited) Python bindings based on numpy.ndarray
* cmake-based platform-independent build system
* Matlab-bindings for some functions
* algorithms for optimization (L1-constrained least squares, LASSO,
non-negative LASSO, least angle regression, quadratic optimization)
* random forest classifier
There is also a minor incompatible change: the angle convention for algorithms
computing an orientation was changed from counter-clockwise to clockwise in
order to better conform to the left-handed image coordinate system.
Enjoy!
Ulli Koethe
_______________________________________________
Vigra mailing list
vi...@informatik.uni-hamburg.de
https://mailhost.informatik.uni-hamburg.de/mailman/listinfo/vigra
--- End Message ---
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig