Skip to main content

All Questions

0 votes
0 answers
46 views

Python Resource Allocation of Devices

I am looking for some optimization algorithm suggestion on resource allocation. Preferably in Python. I have a given number of total resources, and I have to conduct a certain number of Experiments ...
Jesh Kundem's user avatar
2 votes
1 answer
82 views

Python Vectorized Mask Generation (Numpy) [closed]

I have an arbitrary Matrix M which is (N x A). I have a column vector V (N x 1) which has on each row the amount of entries I would like to keep from the original M <= A (starting from the leftmost)...
rankednullity's user avatar
2 votes
0 answers
74 views

Fastest way to find eigenvalues and Eigenvectors for VERY large matrices

I am trying to find the eigenvectors and eigenvalues for very large square symmetric matrices. They are Laplacian matrices on the vicsek fractal. The matrices are in the scale of (5n ⋅ 4 + 1) where i ...
ThatWeirdGuyChris's user avatar
5 votes
1 answer
104 views

Is there a Numpy method or function to split an array of uint64 into two arrays of uint32

Say I have an array as follows: arr = np.asarray([1, 2, 3, 4294967296, 100], dtype=np.uint64) I now want two arrays, one array with the lower 32 bits of every element, and one with the upper 32 bits ...
lrdewaal's user avatar
  • 352
1 vote
2 answers
131 views

How can I optimize Python code for analysis of a large sales dataset?

I’m working on a question where I have to process a large set of sales transactions stored in a CSV file and summarize the results. The code is running slower than expected and taking too much time ...
Pratyush Goutam's user avatar
0 votes
0 answers
109 views

Optimizing turning integer vectors into binary vectors

I have a bunch of 4 million integer vectors that I have to convert to binary. My code is as follows: def integer_vectors_to_binary(data, bits=16): bin_arr = [] for arr in tqdm(data, desc="...
giantjenga's user avatar
1 vote
1 answer
66 views

How to efficiently compute and process 3x3x3 voxel neighborhoods in a 3D NumPy array?

I am working on a function to process 3D images voxel-by-voxel. For each voxel, I compute the difference between the voxel value and its 3x3x3 neighborhood, apply distance-based scaling, and determine ...
Laurids's user avatar
  • 13
0 votes
4 answers
286 views

Best way to calculate boolean matrix multiplication in numpy

I want calculate the matrix product of a boolean array with its transpose: import numpy as np a = np.array([[1, 0, 1], [1, 1, 0]], dtype=bool) What's the best/fastest way of doing this? I made ...
Hackster's user avatar
  • 165
1 vote
3 answers
130 views

How can I quickly generate a (large) list of random numbers given a list of seeds as input?

I need to make a function that takes in an array of integers and returns a list of random numbers with the same length as the array. However, there is the restriction that the output random number ...
rtg142857's user avatar
0 votes
2 answers
103 views

Python basic summation vs the built-in sum function

I'm trying to benchmark some algorithms on floating point numbers using the asymptotics expansion of the harmonic sum: H_n = ln(n) + gamma + o(1), where gamma is the Euler-Mascheroni constant (...
MathTolliob's user avatar
1 vote
0 answers
76 views

Optimizing Multi-Criteria Comparisons with Large DataFrames in Python

I’m working on a project involving sports performance analysis where I need to compare rows of a DataFrame based on multiple criteria (age, performance, and date). For each row, I need to compare it ...
Kévin Letellier's user avatar
3 votes
1 answer
129 views

How can I optimize the performance of this numpy function

Is there any way optimizing the performance speed of this function? def func(X): n, p = X.shape R = np.eye(p) delta = 0.0 for i in range(100): delta_old = delta Y = X @ ...
nicrie's user avatar
  • 503
0 votes
3 answers
152 views

Trying to optimize my ARPLS implementation

I'm trying to optimize my spectral baseline fitting algorithm (based on this one), since, from my understanding, NumPy's apply_along_axis performance is not significantly higher than simply looping ...
srcLegend's user avatar
0 votes
0 answers
78 views

Numba JIT code runs twice as slow as original code

I am attempting to optimize a function I wrote to get the k Nearest Neighbors of a vector in python using Numba JIT. However, the Numba version of my code runs twice as slow as the original code. I ...
Anili's user avatar
  • 138
0 votes
1 answer
152 views

How to Generate a Random Complex Symmetric Unitary Matrix in Python?

I am trying to optimize a complex symmetric unitary matrix 𝐴 with dimensions N*N using Python. First of all, how to generate matrix 𝐴 that should satisfies the two conditions: 𝐴=𝐴^{T} (...
learning statistics 's user avatar

15 30 50 per page
1
2 3 4 5
64