<div dir="ltr">Hi,<div><br></div><div>I've recently been using the following pattern to create arrays of a specific repeating value:</div><div><br></div><div>from numpy.lib.stride_tricks import as_strided<br></div><div>value = np.ones((1,), dtype=float)</div><div>arr = as_strided(value, shape=input_array.shape, strides=(0,))</div><div><br></div><div>I can then use arr e.g. to count certain pairs of elements using sparse.coo_matrix. It occurred to me that numpy might have a similar function, and found np.repeat. But it seems that repeat actually creates the full, replicated array, rather than using stride tricks to keep it small. Is there any reason for this?</div><div><br></div><div>Thanks!</div><div><br></div><div>Juan.</div></div>