Re: [C++-sig] How to call reshape((M,N),order='F') ?

2009-10-28 Thread Sebastian Walter
ive the second parameter as > > order = 'C' or 'F' > > Now the question is: is it possible to specify a named parameter from > the C++ code ? > If the answer is "yes", how ? > > Thank you in advance, > Michele > > -- > Michele De St

Re: [C++-sig] operator+(A, B) without B::B() default constructor in boost.python

2009-05-18 Thread Sebastian Walter
gt; Hans > > > > - Ursprüngliche Mail >> Von: Sebastian Walter >> An: Development of Python/C++ integration >> Gesendet: Freitag, den 15. Mai 2009, 11:02:23 Uhr >> Betreff: Re: [C++-sig] operator+(A, B) without B::B() default constructor in >>

Re: [C++-sig] operator+(A, B) without B::B() default constructor in boost.python

2009-05-15 Thread Sebastian Walter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hans Roessler schrieb: Hello Hans, in my experience .def(self+other) often didn't quite do what I expected. You could try something like that: int int__add__A_B(const A &lhs, const B &rhs){ return operator+(A,B); } .def("__add__", &int__add__A

Re: [C++-sig] create boost array from a Numpy PyArray without copying data?

2009-01-23 Thread Sebastian Walter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey, thanks for your replies: they helped a lot. Ravi schrieb: > On Thursday 22 January 2009 05:51:20 Sebastian Walter wrote: >> In my above case I know that *x won't be deleted because it is global, >> right? > > *x is

Re: [C++-sig] create boost array from a Numpy PyArray without copying data?

2009-01-22 Thread Sebastian Walter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ravi schrieb: > On Wednesday 21 January 2009 03:40:00 Sebastian Walter wrote: >> Apparently I have to increase the refcount manually when I return a raw >> PyObject. So I wrote getter functions like that: >> >>

Re: [C++-sig] create boost array from a Numpy PyArray without copying data?

2009-01-21 Thread Sebastian Walter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ravi schrieb: > On Tuesday 20 January 2009 04:27:02 Sebastian Walter wrote: >> Thanks for the hint :), >> Your code is a little to heavyweight for my purposes, >> but I learned quite a lot how boost::python converters work. >

Re: [C++-sig] create boost array from a Numpy PyArray without copying data?

2009-01-20 Thread Sebastian Walter
andle<>(PyArray_SimpleNewFromData(1, &N, PyArray_DOUBLE, x; double *y = static_cast PyArray_DATA(numpy_x.ptr()); y[0] = 37.; for(int n = 0; n On Monday 19 January 2009 07:16:10 Sebastian Walter wrote: >> My question is: >> How can I create a >> boost::py

[C++-sig] create boost array from a Numpy PyArray without copying data?

2009-01-19 Thread Sebastian Walter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, On the C++ side I have a raw pointer: double *x; I'd like to change its values from within Python by using Numpy. Example code can be found below. My approach is 1) make PyArray from existing data *x with PyArray_SimpleNewFromData 2) create a b

[C++-sig] call Python function from C++ without copying the arguments

2009-01-17 Thread Sebastian Walter
port * def f(a): a.x = 12345 Thanks in advance, Sebastian Walter -- Sebastian Walter Institut fuer Mathematik, Humboldt-UniversitaetTel: +49 (30) 2093-5869 Rudower Chaussee 25, Adlershof, Berlin Fax: +49 (30) 2093-5859 Post: Unter den Linden 6, D-10099 Berlin