cython Questions

1

Solved

Even if numba, cython (and especially cython.inline) exist, in some cases, it would be interesting to have inline C code in Python. Is there a built-in way (in Python standard library) to have inli...
Zenobia asked 12/12, 2020 at 23:47

3

Solved

I'm new to Cython, but got it working by following this basic guide from the official docs: All it says is: "Cython has a way to visualise where interaction with Python objects and Python’s C-...
Ard asked 8/7, 2019 at 4:37

5

Solved

I have two numpy arrays of the same length that contain binary values import numpy as np a=np.array([1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0]) b=np.array([1, 1, 1, 1, 0, 1, 1...
Selfappointed asked 23/9, 2015 at 2:51

0

I am unable to speed up computations with my cythonized version of a function bulk_phone_finder defined below (that uses phonenumbers pypi library) to : from phonenumbers import PhoneNumberMatcher ...
Imposing asked 21/11, 2020 at 3:33

1

I compile a python c module extension in Python 3.6. It works well in Python 3.6 environment but does not work in Python 3.7 and 3.8 environments, it gets error cannot import name 'cygrpc'. I wonde...
Bryantbryanty asked 2/11, 2020 at 23:33

2

I am trying to link to my own C library from Cython, following the directions I've found on the web, including this answer: Using Cython To Link Python To A Shared Library I am running IPython th...
Boots asked 24/4, 2016 at 19:28

2

Solved

According to the documentation it is possible to use C header files generated from Cython. I have followed the Hello World example with no problem and now I want to try something different. I want ...
Exhortation asked 31/7, 2017 at 15:13

1

Solved

I coerced Cython to use clang by specifying the CC environment variable: import os os.environ['CC'] = 'clang' I have a standard build: EXT_MODULES = [Extension('example.src.ex', sources=['example...
Frowsy asked 8/10, 2020 at 13:34

1

I’m trying to follow this tutorial on using pyx, pxd, and cimport to create and use extension types. When compiling the Cython file in terminal, I am getting an error that I don’t know how to corr...
Speos asked 29/1, 2017 at 22:6

2

Solved

I know that a Numba-jitted function calling another jitted function will recognize this and automatically use a fast C calling convention rather than going through the Python object layer, and ther...
Greenheart asked 25/3, 2017 at 12:2

1

Solved

I have a file in my project which I would like to compile for performance reasons: mylibrary/myfile.py How to achieve this with Poetry?
Barbarese asked 31/8, 2020 at 23:9

1

I implemented a pure Python code in object-oriented style. In some of the methods there are time intensive loops, which I hope to speed up by cythonizing the code. I am using a lot of numpy arrays...
Aalborg asked 15/2, 2016 at 17:1

1

Solved

The %%cython command is pretty handy to create cython functions without building and using a package. The command has several options but I couldn't find a way to specify compile time environmental...
Scab asked 7/1, 2017 at 21:4

4

Solved

I have a C++ class. It's made up of one .ccp file and one .h file. It compiles (I can write a main method that uses it successfully in c++). How do I wrap this class with Cython to make it availabl...
Decry asked 19/1, 2012 at 21:5

2

Solved

%%cython from libc.stdio cimport printf def test(): printf('abc') If I run test(), it doesn't print anything. Currently I am doing something stupid as: cdef char s[80] sprintf(s, 'something') ...
Hemipterous asked 25/3, 2015 at 17:36

3

Solved

I'm creating a setup.py file for a project with some Cython extension modules. I've already gotten this to work: from setuptools import setup, Extension from Cython.Build import cythonize setup(...
Nichollenicholls asked 26/5, 2016 at 21:28

3

Solved

I am building a package in Cython. I am using the following as the structure for setup.py: from distutils.core import setup from distutils.extension import Extension from Cython.Build import cytho...
Tunnage asked 19/4, 2016 at 15:41

1

Had a basic question after reading the Cython documentation on classes, but I thought to get it clear. Here is a sample code from the Cython documentation: cdef class Rectangle: cdef int x0, y0 ...
Cabbage asked 26/7, 2015 at 17:12

2

Solved

Code block 1 using __init__ %%cython -3 cdef class c: cdef: int a str s def __init__(self): self.a=1 self.s="abc" def get_vals(self): return self.a,self.s m=c() print(m.get_vals()...
Nemathelminth asked 10/7, 2020 at 4:52

1

Solved

I have a C function that involves decompressing data using zstd. I am attempting to call that function using Cython. Using this page from the docs as a guide I can compile and run the code below wi...
Caressa asked 30/6, 2020 at 17:17

1

I have a Python program which calls some Cython code which in turn wraps some raw C++ code. I would like to see how much memory the base C++ code is allocating. I've tried the memory_profiler modul...
Photoflash asked 10/1, 2017 at 16:24

2

Solved

I am trying to package my project code into a an executable binary using Cython and PyInstaller libraries. My code directory looks like this: The main.py is the main code which imports the logic ...
Germano asked 16/4, 2019 at 12:11

2

I am trying to build a Python multi-file code with PyInstaller. For that I have compiled the code with Cython, and am using .so files generated in place of .py files. Assuming the 1st file is main...
Robbegrillet asked 2/7, 2014 at 7:59

1

Solved

Following is a Cython code snippet currently used in scikit-learn binary trees, # Some compound datatypes used below: cdef struct NodeHeapData_t: DTYPE_t val ITYPE_t i1 ITYPE_t i2 # build t...
Markle asked 18/6, 2020 at 11:26

2

I have a C++ program and it has sort of plugin structure: when program starts up, it's looking for dll in the plugin folder with certain exported function signatures, such as: void InitPlugin(Func...
Sheaff asked 29/8, 2013 at 15:36

© 2022 - 2024 — McMap. All rights reserved.