Fix an error in assertion statements.

* Raise an exception if matrix type is not `DenseMatrix`.
* Use `==` in assertion statements. I have been using `=` by a mistake.