new version incorporates sparse matrices
new version incorporates sparse matrices