constructor with matrix size buffer