Change MatrixBase

This commits are subset of #134. To help reviewing, I divided the branch into small change set.

This change set will add template parameters (FP_TYPE, IDX_TYPE) and some member functions to MatrixBase class so that one can use it as interface of any matrix implementations. Its sub classes had to be changed.