add sum to fwd/matrix with tests