Created common matrix API (dense and sparse).