avoid duplicated code
consistent matrix types
update README.md
matrix types