[Numpy-discussion] Re: advice for using datetime64 in C binding

2022-02-18 Thread Benoit Gschwind
Thank you for fixing my code ! :) On Fri, 2022-02-18 at 09:00 -0600, Sebastian Berg wrote: > On Fri, 2022-02-18 at 15:53 +0100, Benoit Gschwind wrote: > > Hello, > > > > I found my ankser in own code ^^ > > > > static PyArray_D

[Numpy-discussion] Re: advice for using datetime64 in C binding

2022-02-18 Thread Benoit Gschwind
dtype; } On Thu, 2022-01-20 at 09:20 +0100, Benoit Gschwind wrote: > Hello, > > How can I create np.dtype("datetime64[ms]") in C to get the > coresponding PyArray_Descr ? > > Thank you by advance > > On Wed, 2022-01-19 at 10:08 +0100, Benoit Gschwind wrote:

[Numpy-discussion] Re: advice for using datetime64 in C binding

2022-01-20 Thread Benoit Gschwind
Hello, How can I create np.dtype("datetime64[ms]") in C to get the coresponding PyArray_Descr ? Thank you by advance On Wed, 2022-01-19 at 10:08 +0100, Benoit Gschwind wrote: > Hello Sebastian, > > Thanks for the precision > > Best regards > > On Tue, 2022-

[Numpy-discussion] Re: advice for using datetime64 in C binding

2022-01-19 Thread Benoit Gschwind
Hello Sebastian, Thanks for the precision Best regards On Tue, 2022-01-18 at 11:52 -0600, Sebastian Berg wrote: > On Tue, 2022-01-18 at 18:29 +0100, Benoit Gschwind wrote: > > Hello Sebastian, > > > > Thanks for detail. > > > > The last call h

[Numpy-discussion] Re: advice for using datetime64 in C binding

2022-01-18 Thread Benoit Gschwind
18 at 14:56 +0100, Benoit Gschwind wrote: > > Hello, > > > > I using the following code: > > > > if (PyArray_TYPE(arr1) == NPY_DATETIME) { > > // Ensure datetime64[ms] > > auto tmp = > > reinterpret_cast(PyObject_CallMethod(reinterpr

[Numpy-discussion] advice for using datetime64 in C binding

2022-01-18 Thread Benoit Gschwind
Hello, I using the following code: if (PyArray_TYPE(arr1) == NPY_DATETIME) { // Ensure datetime64[ms] auto tmp = reinterpret_cast(PyObject_CallMethod(reinterpret_cast(arr1), "astype", "(s)", "datetime64[ms]")); std::swap(arr1, tmp); Py_XDECREF(tmp); // En

Re: [Numpy-discussion] Handle type convertion in C API

2020-03-11 Thread Benoit Gschwind
ver the arrays, etc > for you. The documentation is available here: > https://numpy.org/doc/1.18/user/c-info.ufunc-tutorial.html. > > Regards, > > Eric > > On Tue, Mar 10, 2020 at 12:28 PM Benoit Gschwind < > gschw...@gnu-log.net> wrote: > > Hello, > &g

[Numpy-discussion] Handle type convertion in C API

2020-03-10 Thread Benoit Gschwind
Hello, I writing a python binding of one of our library. The binding intend to vectorize the function call. for exemple: double foo(double, double) will be bound to a python: module.foo(, ) and the function foo will be called like : for (int i = 0; i < size; ++i) outarr[i] = foo(inarr