I have numpy array/matrix of shape `(4096,4096)` and an array of elements that should be set to zero. I have found function `numpy.in1d` that works fine but is very slow for my computations. I was wondering if exists some faster way for this execution because I need to repeat this on very large number of matrices so every optimization is helpful.

Here is example:

The numpy array looks like this:

```
npArr = np.array([
    [1, 4, 5, 5, 3],
    [2, 5, 6, 6, 1],
    [0, 0, 1, 0, 0],
    [3, 3, 2, 4, 3]])

```

and another array is :

```
arr = np.array([3,5,8])

```

The numpy array `npArr` should look like after the replacement:

```
array([[ 1,  4,  0,  0,  0],
       [ 2,  0,  6,  6,  1],
       [ 0,  0,  1,  0,  0],
       [ 0,  0,  2,  4,  0]])

```