time to invert dense matrix: 1 sec at about 1000x1000; neglegible at 100 x 100.
gradient not as rosy as I thought