Fix linear combiation matrix computation.

An incorrect matrix of linear combinations was returned.
This is in part due to the fact that the intersection
matrix ws incorrectly computed and in part due to the
function itself returning the wrong intermediate matrix.