Added support to dense matrices