I have a 1-D numpy array a with arbitrary size N, and I have other numpy array b with exactly 2 columns and M rows. I want to build a 2-D array with shape (M, N) where the (i,j) element is the bool value b[:,0][i] <= a[j] <= b[:,1][i]. I want a solution that does not go through a for loop.
Example:
import numpy as np
a = np.array([10, 2, 5])
b = np.array([[ 0, 5],[ 5, 10]])
# Expected array
np.array([[False, True, True], [True, False, True]])