protected double kernel(int n,char[] s,int endIndexS,char[] t,int endIndexT){
  if (Math.min(endIndexS + 1,endIndexT + 1) < n) {
    return getReturnValue(n);
  }
  double result=0;
  for (int iS=endIndexS; iS > n - 2; iS--) {
    double buf=0;
    char x=s[iS];
    for (int j=0; j <= endIndexT; j++) {
      if (t[j] == x) {
        buf+=kernelHelper(n - 1,s,iS - 1,t,j - 1);
      }
    }
    result+=buf * m_powersOflambda[2];
  }
  return result;
}

protected double kernel ( int n , char [ ] s , int endIndexS , char [ ] t , int endIndexT ) { if ( Math . min ( endIndexS + 1 , endIndexT + 1 ) < n ) { return getReturnValue ( n ) ; } double result = 0 ; for ( int iS = endIndexS ; iS > n - 2 ; iS -- ) { double buf = 0 ; char x = s [ iS ] ; for ( int j = 0 ; j <= endIndexT ; j ++ ) { if ( t [ j ] == x ) { buf += kernelHelper ( n - 1 , s , iS - 1 , t , j - 1 ) ; } } result += buf * m_powersOflambda [ 2 ] ; } return result ; }
the kernel function ( kn ) . this function performs the outer loop character - wise over the first input string s . for each character encountered , a recursion branch is started that identifies all subsequences in t starting with that character . < br > see [ 1 ] for details but note that this code is optimized and may be hard to recognize .
