created toDense() test-case
fixed nVal-array creation
fixed index dense