I'm trying to speed up the following function using numba.
import numpy as np
from numba import jit, prange
@jit(nopython=True, parallel=True)
def find_reg_numba(states):
reg = []
states_sum = np.sum(states, axis=1)
for i in prange(states.shape[0]):
if states_sum[i] > 0 and states_sum[i] < 5:
reg.append(states[i])
return reg
The states
is generated using the following function
def generate_states(size):
# size is a natural number
states = np.array(list(map(list, itertools.product([0., 1.], repeat = size))))
return states
When I try to use the find_reg
function, I get the following error trace.
double free or corruption (!prev)
Aborted (core dumped)
My numba version is 0.48.0
.
How to solve this issue?