it uses vector to build the matrix#