All Questions
21 questions
5
votes
3
answers
291
views
Fast complex absolute argmax in Cython
I'm thinking I implemented it optimally, but somehow it's much slower than what should be much slower, np.argmax(np.abs(x)). Where am I off?
Code rationale & ...
6
votes
1
answer
153
views
basic Hartee-Fock program to compute the total energies and some properties of a molecule
I am trying to write a basic Hartee-Fock program that computes the total energies and some properties of a molecule given as an input. The code uses Cython to statically compile the computationally ...
2
votes
1
answer
196
views
type hinting/documenting/extension of a Cython lib
I've updated some of the type hinting/documentation in a lib called pygrib. The source documentation
can be found here.
The goal is to extend the ...
4
votes
0
answers
997
views
Slow copying of memmap array to numpy array
I have multiple binary (structured) file, each of 2GB, which I am currently reading in pair, using memmap to cross-correlate the same. I want to minimise the time required by this IO process, in the ...
4
votes
2
answers
4k
views
Cython with variable-length arrays
Dynamically growing arrays are a type of array. They are very useful when you don't know the exact size of the array at design time. First you need to define an initial number of elements. (Wikipedia)
...
4
votes
1
answer
560
views
Cython functions for generating NumPy date ranges
I have rewritten my python code in cython in order to speed up it quite a bit. However after checking the code in jupyter it seems that part of it is still compiled as python code, therefore its not ...
7
votes
2
answers
883
views
Computing the gradient of a function
I have some Python code which uses NumPy which computes gradient of a function and this is a big bottleneck in my application. So, my initial attempt was to try to use Cython to improve the ...
3
votes
2
answers
120
views
Cythonized Sutherland-Hogman algorithm
I want to cythonise the python implementation of the Sutherland-Hogman algorithm. This algorithm updates a list of vertices according to pretty simple rules (being inside or outside an edge, etc.) but ...
3
votes
0
answers
162
views
Speed up a Gibbs sampler with Cython
I have implemented a Gibbs sampler to generate textured images. According to the beta parameters (array of shape(4)), we can generate various textures.
Here is my ...
13
votes
3
answers
1k
views
Fast Python spring network solver
I wanted a very simple spring system written in Python. The system would be defined as a simple network of knots, linked by links...
3
votes
2
answers
23k
views
Efficiently index rows of numpy array by exclusion
I need a function that takes a numpy array and a row number as inputs and returns the array (or copy of the array) excluding the given row. I want to do this as efficiently as possible.
...
6
votes
2
answers
2k
views
Fastest possible Cython for Black-Scholes algorithm
I started with a pure python implementation, and have been trying to get the performance as close to native C as possible using numpy, numexpr, and cython. Here is the the numpy version that I ...
13
votes
1
answer
1k
views
A big "Game of Life"
Our quest: Create a big simulation for Conway's Game of Life, and record the entire simulation history.
Current Approach: Cython is used for an iterate method. The ...
5
votes
1
answer
1k
views
Resource-constrained project scheduling
I'm trying to implement an algorithm for a resource-constrained project scheduling problem. I have several resources, resource constraints and all of this is in ...
4
votes
1
answer
5k
views
Fastest computation of N likelihoods on normal distributions
In the context of a Gibbs sampler, I profiled my code and my major bottleneck is the following:
I need to compute the likelihood of N points assuming they have been drawn from N normal distributions ...