The general principle is, considering a function for which we know
values at m
equally spaced points (for instance 1/m
,
2/m
, ..., 1), to compute the matrix giving the linear
approximation of n
equally spaced points (for instance
1/n
, 2/n
, ..., 1).
The function works whether n
or m
is the largest.
The function is vectorized, so m
and n
can be vectors of
integers. In this case, they have to be of the same size and the
resulting matrix is block diagonal.