Topic/plat 6703

The k^th order difference matrix will act on a vector to produce the k^th order difference series.  Related to this is the k^th order finite difference differentiation matrix which acts on the values of a function evaluated at a (non-uniformly spaced) set of points, to give the estimate of the k^th order derivative at those points (for unit spaces points these are identical). 
One use of these matrices, is to  provide matrices that penalise the gradient or curvature of data on a non-uniform grid. This should work for an arbitrary number of dimensions (for data that has been flattened to a vector). 
This else block is unnecessary since the if {} and if else {} preceding it both move control flow outside of this function.