Updated test suite based on pull request comments. Still needs fixing at
line 1227 where C is undefined.
Updated code using ravel() and now able to set values based on an array. A
tradeoff has to be made between code duplication and memory usage. Making
everything into the same shape would be the most elegant, but A[:, :] = 1
would generate three arrays (i, j, x) all having the same size as A. If there
is desire to simplify the code, that can be easily done.