Removed calls to matrix() in distance()

Since _matrix is now a single dimension matrix, calls to matrix() have
been removed and replaced with direct access equivalents.