TABLE OF CONTENTS


CinitRoutine/cMakePenalty2diff [ Functions ]

NAME

    cMakePenalty2diff --- compute a penalty matrix on second derivatives

FUNCTION

Generates a penalty matrix that penalizes the integral of the squared second derivative of a curve. See also makePenalty.2deriv.

This function should be called cMakePenalty2deriv, but I'm scared of changing its name.

SYNOPSIS

436 void cMakePenalty2diff(double *P, double *knots, int *ord, int *K)

INPUTS

    P     a matrix of dimension (K+ord) x (K+ord)
    knots set of knots on which the spline is defined
    ord   order of the spline
    K     number of interior knots

OUTPUTS

SOURCE

440 {
441     // P should be (K+ord)^2
442     int nj = *K + *ord;
443     for(int j1=0; j1<nj; j1++)
444     {
445         for(int j2=j1; j2<nj; j2++){
446             P[j1 + j2*nj]=cSplineDerivInt(2, *ord, j1, 2, *ord, j2, knots, *ord);
447             P[j2 + j1*nj]=P[j1 + j2*nj];
448         }
449     }
450 }