This handful of lines can be cut to:
```
X = coo_matrix(X, copy=False)
Y = coo_matrix(Y, copy=False)
```