using sparse matrix for spline calculation