code: private void fillPsubMatrix( Coordinate[] controlPoints, GeneralMatrix L ) {
          int controlPointsNum = controlPoints.length;
          for( int i = 0; i < controlPointsNum; i++ ) {
              L.setElement(i, i, 0);
  
              L.setElement(i, controlPointsNum + 0, 1);
              L.setElement(i, controlPointsNum + 1, controlPoints[i].x);
              L.setElement(i, controlPointsNum + 2, controlPoints[i].y);
  
              L.setElement(controlPointsNum + 0, i, 1);
              L.setElement(controlPointsNum + 1, i, controlPoints[i].x);
              L.setElement(controlPointsNum + 2, i, controlPoints[i].y);
          }
      }
docs: Fill L submatrix (<a href="http://elonen.iki.fi/code/tpsdemo/index.html"> see more here</a>)