changed construct-matrix and added vector-dimensionality