Fix coordinate calculation in DMat::from_fn().

The builder function `f` was receiving incorrect coordinates, often
involving a uint underflow.

Added a test case to verify the new behavior.
Merge pull request #16 from nathanic/master

Fix coordinate calculation in DMat::from_fn().