Questions tagged [cython]

Ask Question

Cython is a superset of the Python language for quickly generating Python C extensions.

4,868 questions

0votes1answer11views

Can't access class @property from other @property in Cython

I'm learning Cython and ran into the following weird bug import cython cdef double MILES_PER_KILOMETER = 0.621371 cdef class Distance: cdef double distance, miles, meters, km def __cinit__(... user avatar Jonathan

  • 9,645
0votes0answers22views

How to make a cython library available to my python program?

I am working on a legacy project which uses a cython library: engine.cpython-37m-x86_64-linux-gnu.so It is downloaded to my current working directory: engine.cpython-37m-x86_64-linux-gnu.so test.py ... user avatar marlon

  • 4,303
0votes0answers51views

Optimise cython speed in for loop

I am implementing a Cython script for speeding up the reading of np.loadtxt in Python. This process takes about 5 minutes to go through 7000 txt files with 12501 rows in it. With MATLAB, this takes ... user avatar Andres

  • 1
0votes1answer44views

Cython multinomial distribution

What is the most efficient way to get a multinomial distribution (say for n=1 trial) in cython? For example, I have three probabilities p0=0.1, p1=0.2, p2=0.7 (which sum to 1) and want to have x to be ... user avatar black

  • 951
1vote0answers40views

Speedup cython via call by reference

I am writing a software library in C++, which is wrapped in Python via Cython. However, the Python-C++ librbary is approximately 100 times slower (10 sec vs. 0.6 sec) than implementing the same code ... user avatar Andreas Rupp

  • 11
0votes0answers31views

Using cython and gcc compiler [duplicate]

I'm having issues trying to get cython working with the gcc compiler. I want to use the gcc compiler because I've heard it's harder to get your code from the executable using pyinstaller. I'm on 64-... user avatar Jims313

  • 1
0votes0answers31views

How to speed up the following code using numba? Numba Warning: The size argument is not supported in the following functions

I really want to speed up the code below by Numba. But I notice that Numba does not support generate normal distribution with size like np.random.normal(size=(nprime, nprime)). Is there any ... user avatar Eciel

  • 43
-7votes0answers34views

How to use cython to increase the performance of python that does not require much calculation? [closed]

From what I understand, cython should only make more computational python code faster. user avatar Paras Singh

  • 1
0votes0answers30views

How to Cythonize an Ansible module

Is it possible to have a Cythonized script as an Ansible custom module ? When i tried with .pyx or compiled .so, Ansible did not recognize them. Is there any specific restriction ? Otherwise how do i ... user avatar Vin pk

  • 1
0votes1answer37views

Cython C++ templates problems

This is my C++ code /** * A CSI data format converter * @tparam OutputValueType * @tparam InputValueType * @param inputArray * @return */ template<typename OutputValueType, typename ... user avatar HerrTian

  • 1
-3votes0answers33views

How to rewrite this function in Cython? [closed]

I can't get the logic in writing functions in cython, yet. def haversine_vector (arr_lon1, arr_lat1, arr_lon2, arr_lat2): arr_dlon = arr_lon1 - arr_lon2 arr_dlat = arr_lat1 - arr_lat2 ... user avatar DDR

  • 417
0votes1answer31views

ray in Cython error: The @ray.remote decorator must be applied to either a function or to a class

I apply ray with Cython. It shows an error: TypeError: The @ray.remote decorator must be applied to either a function or to a class. How to solve this problem? Thanks. The setup.py: from distutils.... user avatar Eciel

  • 43
0votes0answers25views

cython cimport from another pyx file

I have a project with the following structure: lst_viewer/ setup.py extensions/ instrument.pxd instrument.pyx read_events.pyx src/ lst_viewer/ ... user avatar Eurydice

  • 7,203
0votes0answers20views

Joblib Parallel + Cython Slower [closed]

I want to speed up my code computed parallel by joblib and Cython. But when I increase the number of for loops, Cython + joblib is slower than joblib. I also imported numpy in Cython. What's the ... user avatar Eciel

  • 43
0votes0answers18views

Error when splitting pyx file into pxd and pyx file

I would like to split a pyx file which contains the declaration and definition of a class hierarchy into a pxd and pyx file for further use in another cython module. Here is my pxd file (instrument.... user avatar Eurydice

  • 7,203

153050per page

1 2 3 4 5325

You Might Also Like