Let us consider a matrix A as a diagonal matrix and a matrix B a random matrix, both with size N x N.
We want to use the sparse properties of the matrix A to optimize the dot product, i.e. dot(B,A).

However if we compute the product using the sparcity properties of the matrix A, we cannot see any advantage (and it is much slower).

```
import numpy as np
from scipy.sparse import csr_matrix
# Matrix sizes
N = 1000

#-- matrices generation --
A = np.zeros((N,N), dtype=complex)
for i in range(N):
    A[i][i] = np.random.rand()
B = np.random.rand(N,N)

#product
%time csr_matrix(B).dot(A)
%time np.dot(B,A)

```

Results:

CPU times: user 3.51 s, sys: 8 ms, total: 3.52 s
Wall time: 3.74 s

CPU times: user 348 ms, sys: 0 ns, total: 348 ms
Wall time: 230 ms

How to do it correctly?