Re: [C++-sig] Status of Numpy support in boost python

2010-03-09 Thread Pim Schellart
Hi Everyone,

wow! I am overwhelmed by the amount of response to this request.
I looked at the other options and must say I agree with Jim Bosch' comment:

> The whole point of using numpy with C++ is to be able to go
> from raw pointers to numpy arrays and back, and that doesn't seem to be
> possible with an interface that just calls the Python API (as the
> numeric interface does at present).

for fast numerical calculations callbacks into Python are not a good option.
In terms of the discussion concerning compiled or header only I think
that although it would be nice and clean to have a header only
library, as it stands boost python has to be compiled anyway and I
think adding numpy as an optional dependency would not be bad because
users who want to use this functionality by definition have numpy
installed as well.
I do think it would not be good to add it as a required dependency for
boost python since numpy is (not yet) part of the Python standard
library.

Since I am not a core numpy or boost developer and have little
experience working directly with the numpy C api any code
contributions from me would probably be ugly.
However I am keen to see numpy support in boost python as soon as
possible and would like to help on for instance testing or writing
documentation.
I could probably also help to add the numpy support to the cmake
builld system for boost.

Kind regards,

Pim Schellart
___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] Status of Numpy support in boost python

2010-03-09 Thread Stefan Seefeld

On 03/09/2010 06:34 AM, Pim Schellart wrote:


for fast numerical calculations callbacks into Python are not a good option.
In terms of the discussion concerning compiled or header only I think
that although it would be nice and clean to have a header only
library, as it stands boost python has to be compiled anyway and I
think adding numpy as an optional dependency would not be bad because
users who want to use this functionality by definition have numpy
installed as well.
   


You may be forgetting that the one installing boost.python isn't 
necessarily the one compiling it. Not all users of boost.python need 
numpy. Thus, should there be two boost.python packages, one with and one 
without numpy dependency ?
I think it would be cleaner to factor that out, unless it can be kept in 
a header-only form.


Stefan

--

  ...ich hab' noch einen Koffer in Berlin...

___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] Status of Numpy support in boost python

2010-03-09 Thread Neal Becker
No luck with boost-1.42.  fedora-12 boost-1.39 seems OK.

Lots of errors, like:
/usr/local/src/boost.hg/boost/fusion/container/vector/convert.hpp: In 
instantiation of 
'boost::fusion::result_of::as_vector,
 
0>, boost::fusion::vector_iterator, 
-0x1> > >':
include/ndarray/views.hpp:210:   instantiated from 
'ndarray::detail::ViewTraits<3, 3, boost::fusion::vector0 >'
include/ndarray/views.hpp:216:   instantiated from 
'ndarray::detail::ViewTraits<3, 3, 
boost::fusion::vector1 >'
include/ndarray/views.hpp:216:   instantiated from 
'ndarray::detail::ViewTraits<3, 3, 
boost::fusion::vector2 
>'
include/ndarray/views.hpp:216:   instantiated from 
'ndarray::detail::ViewTraits<3, 3, 
boost::fusion::vector3 >'
include/ndarray/Array.hpp:136:   instantiated from 'ndarray::Array::ResultOf >, 
boost::fusion::vector3 >'
tests/ndarray.cc:109:   instantiated from here
/usr/local/src/boost.hg/boost/fusion/container/vector/convert.hpp:26: error: 
invalid use of incomplete type 'struct 
boost::fusion::detail::as_vector<-0x1>'
/usr/local/src/boost.hg/boost/fusion/container/vector/detail/as_vector.hpp:26: 
error: declaration of 'struct 
boost::fusion::detail::as_vector<-0x1>'
tests/ndarray.cc: In member function 'void casts::test_method()':
tests/ndarray.cc:109: error: no match for 'operator[]' in 
'd[ndarray::View::operator()() const [with SeqT = 
boost::fusion::vector2]
()]'

___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] Status of Numpy support in boost python

2010-03-09 Thread Neal Becker
Do you intend to include some examples?

___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] Status of Numpy support in boost python

2010-03-09 Thread Stefan Seefeld

On 03/08/2010 07:41 PM, Neal Becker wrote:

Do you intend to include some examples?
   


That is unfortunately not quite easy, as the (in this context) 
interesting bits are mixed with lots of other code that is not relevant 
here.


I will try to refactor things the way I envision this array wrapper to 
look like.


Thanks,
Stefan


--

  ...ich hab' noch einen Koffer in Berlin...

___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] Status of Numpy support in boost python

2010-03-09 Thread Jim Bosch
On Tue, 2010-03-09 at 11:53 -0500, Neal Becker wrote:
> No luck with boost-1.42.  fedora-12 boost-1.39 seems OK.
> 
> Lots of errors, like:
> /usr/local/src/boost.hg/boost/fusion/container/vector/convert.hpp: In 
> instantiation of 
> 'boost::fusion::result_of::as_vector,
>  
> 0>, boost::fusion::vector_iterator, 
> -0x1> > >':

> tests/ndarray.cc: In member function 'void casts::test_method()':
> tests/ndarray.cc:109: error: no match for 'operator[]' in 
> 'd[ndarray::View::operator()() const [with SeqT = 
> boost::fusion::vector2]
> ()]'
> 

Just to keep everyone following this thread sane, I'd like to point out
that this refers to my ndarray C++ library, *not* what I put in the
boost sandbox; the latter is much simpler, much more
boost.python-specific, and generally lower-level.  I'd like it to morph
into something that could be included as an optional part of
boost.python, and I'd ultimately like to rewrite the Python-interfacing
parts of my ndarray library to make use of it.

That said, thanks for the heads-up on the compile failures in ndarray,
Neil - I've been using boost 1.40, and it looks like I've got some work
to do to make it compatible with later releases.  I'll keep the list
posted on my progress, and I'll look into making some examples as well.

Jim


___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig