[Numpy-discussion] Windows, blas, atlas and dlls
V. Armando Sole
sole at esrf.fr
Fri Feb 22 14:21:45 EST 2013
On 22.02.2013 19:54, Sergio Callegari wrote:
>>
>> from scipy.linalg.blas import fblas
>> dgemm = fblas.dgemm._cpointer
>> sgemm = fblas.sgemm._cpointer
>>
>
> OK, but this gives me a PyCObject. How do I make it a function
> pointer of the
> correct type in cython?
>
In cython I do not know it. I coded it directly in C.
In my code I receive the pointer in input2. The relevant part is:
PyObject *input1;
PyObject *input2 = NULL;
/*pointer to dgemm function */
void * gemm_pointer = NULL;
/** statements **/
if (!PyArg_ParseTuple(args, "OO", &input1, &input2))
return NULL;
if (input2 != NULL){
#if PY_MAJOR_VERSION >= 3
if (PyCapsule_CheckExact(input2))
gemm_pointer = PyCapsule_GetPointer(input2, NULL);
#else
gemm_pointer = PyCObject_AsVoidPtr(input2);
#endif
if (gemm_pointer != NULL)
{
/* release the GIL */
Py_BEGIN_ALLOW_THREADS
/* your function call here */
Py_END_ALLOW_THREADS
}
}
Best regards,
Armando
More information about the NumPy-Discussion
mailing list