minor edits and re-publish demo_matrixreg