remove matrix.cpp and matrix.h dependencies
Revert "removed unused casts"

This reverts commit fdde4a5688e382bf2b3bba62893e6941eafb38cd.
revert blas dependency of matrix.cpp