Add implementation and test for space discretization matries.