fix a bug in dgemm

This fixes a bug in matrix dimensions given to `dgemm`. I've written quite a few tests, before I was able to reproduce the behavior I encountered in my program. Some of the tests just give an incorrect result. There is one that fails completely with `lda must be >= MAX(K,1): lda=2 K=3ldb must be >= MAX(K,1): ldb=2 K=3Parameter 9 to routine cblas_dgemm was incorrect` which is how I discovered the bug.
Some of the tests may be redundant.