_diag example

--$ylim;
    }

    if ($xoff == $xlim || $yoff == $ylim) {
      $lcs = 0;
    }
    else {
      // This is ad hoc but seems to work well.       //$nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5);       //$nchunks = max(2, min(8, (int)$nchunks));       $nchunks = min(7, $xlim - $xoff$ylim - $yoff) + 1;
      [$lcs$seps] = $this->_diag($xoff$xlim$yoff$ylim$nchunks);
    }

    if ($lcs == 0) {
      // X and Y sequences have no common subsequence:       // mark all changed.       while ($yoff < $ylim) {
        $this->ychanged[$this->yind[$yoff++]] = 1;
      }
      while ($xoff < $xlim) {
        $this->xchanged[$this->xind[$xoff++]] = 1;
      }
    }

    function _diag ($xoff$xlim$yoff$ylim$nchunks)
    {
        $flip = false;

        if ($xlim - $xoff > $ylim - $yoff) {
            /* Things seems faster (I'm not sure I understand why) when the * shortest sequence is in X. */
            $flip = true;
            list ($xoff$xlim$yoff$ylim)
                = array($yoff$ylim$xoff$xlim);
        }

        
Home | Imprint | This part of the site doesn't use cookies.