code: private void fillKsubMatrix( Coordinate[] controlPoints, GeneralMatrix L ) {
          double alfa = 0;
          int controlPointsNum = controlPoints.length;
          for( int i = 0; i < controlPointsNum; i++ ) {
              for( int j = i + 1; j < controlPointsNum; j++ ) {
                  double u = calculateFunctionU(controlPoints[i], controlPoints[j]);
                  L.setElement(i, j, u);
                  L.setElement(j, i, u);
                  alfa = alfa + (u * 2); // same for upper and lower part
              }
          }
  
          alfa = alfa / (controlPointsNum * controlPointsNum);
      }
docs: Fill K submatrix (<a href="http://elonen.iki.fi/code/tpsdemo/index.html"> see more here</a>)
  
  @param controlPoints
  @param L