the first and second value in ``function_values``
        must reflect two mirrored solutions sampled
        in direction / in opposite direction of
        the previous mean shift, respectively.
436528
def update(self, es, function_values, **kwargs):
        
        # TODO: on the linear function, the two mirrored samples lead
        # to a sharp increase of condition of the covariance matrix.
        # They should not be used to update the covariance matrix,
        # if the step-size inreases quickly. This should be fine with
        # negative updates though.
        if not self.initialized:
            self.initialize(es.N, es.opts)
        if 1 < 3:
            # use the ranking difference of the mirrors for adaptation
            # damp = 5 should be fine
            z = np.where(es.fit.idx == 1)[0][0] - np.where(es.fit.idx == 0)[0][0]
            z /= es.popsize - 1  # z in [-1, 1]
        self.s = (1 - self.sp.c) * self.s + self.sp.c * np.sign(z) * np.abs(z)**self.sp.z_exponent
        if self.s > 0:
            es.sigma *= exp(self.s / self.sp.dampup)
        else:
            es.sigma *= exp(self.s / self.sp.dampdown)
182723
void set2(int newPrice, int optCur, int back) {
        price = newPrice;
        optPrev = optCur + 1;
        backPrev = back;
        prev1IsLiteral = true;
        hasPrev2 = false;
    }
752401
def reflect(vec1, vec2):
    """"""
    if isinstance(vec1, Vector3) and isinstance(vec2, Vector3) \
            or isinstance(vec1, Vector4) and isinstance(vec2, Vector4):
        return 2 * dot(vec1, vec2) * vec2 - vec2
    else:
        raise ValueError("vec1 and vec2 must both be a Vector type")
1015852
function regualizedBeta(x, a, b) {
	if(x < 0 || x > 1) {
    throw new RangeError('First argument must be between 0 and 1.');
	}

  // Special cases, there can make trouble otherwise
  else if (a === 1 && b === 1) return x;
  else if (x === 0) return 0;
  else if (x === 1) return 1;
  else if (a === 0) return 1;
  else if (b === 0) return 0;

  else {
    var bt =
      Math.exp(gammaCollection.logGamma(a + b) -
      gammaCollection.logGamma(a) -
      gammaCollection.logGamma(b) +
      a * Math.log(x) +
      b * log1p(-x));

    // Use continued fraction directly.
    if (x < (a + 1) / (a + b + 2)) return bt * betacf(x, a, b) / a;
    // else use continued fraction after making the symmetry transformation.
    else return 1 - bt * betacf(1 - x, b, a) / b;
  }
}
884310
def _twofilter_smoothing_ON(self, t, ti, info, phi, lwinfo, return_ess,
                               modif_forward, modif_info):
        
        if modif_info is not None:
            lwinfo += modif_info
        Winfo = rs.exp_and_normalise(lwinfo)
        I = rs.multinomial(Winfo)
        if modif_forward is not None:
            lw = self.wgt[t].lw + modif_forward
            W = rs.exp_and_normalise(lw)
        else:
            W = self.wgt[t].W
        J = rs.multinomial(W)
        log_omega = self.model.logpt(t + 1, self.X[t][J], info.hist.X[ti][I])
        if modif_forward is not None:
            log_omega -= modif_forward[J]
        if modif_info is not None:
            log_omega -= modif_info[I]
        Om = rs.exp_and_normalise(log_omega)
        est = np.average(phi(self.X[t][J], info.hist.X[ti][I]), axis=0,
                         weights=Om)
        if return_ess:
            return (est, 1. / np.sum(Om**2))
        else:
            return est
145848
def two_gaussian(freq, freq0_1, freq0_2, sigma1, sigma2, amp1, amp2,
                   offset, drift):
   
   return (gaussian(freq, freq0_1, sigma1, amp1, offset, drift) +
           gaussian(freq, freq0_2, sigma2, amp2, offset, drift))
1252097
def _polarDecomposeInterpolationTransformation(matrix1, matrix2, value):
    
    m1 = MathTransform(matrix1)
    m2 = MathTransform(matrix2)
    return tuple(m1.interpolate(m2, value))
377830
def _pre_compute_secondary(self, positive_vals, negative_vals):
        """"""
        self._secondary_min = (
            negative_vals and min(min(negative_vals), self.zero)
        ) or self.zero
        self._secondary_max = (
            positive_vals and max(max(positive_vals), self.zero)
        ) or self.zero
155084
def _forward_mode(self, *args):
        """"""
        # Parse arguments into two numpy arrays
        X: np.ndarray
        dX: np.ndarray
        X, dX = self._parse_dicts(*args)
        # The value is X
        if X is not None:
            val = X
        else:
            val = self.X
        # The derivative is the seed dX
        if dX is not None:
            diff = dX
        else:
            diff = np.ones_like(val)
        # Return both arrays
        return (val, diff)
671127
def _shift_or_mirror_into_invertible_i(self, x, i):
        
        assert x is not None
        lb = self._lb[self._index(i)]
        ub = self._ub[self._index(i)]
        al = self._al[self._index(i)]
        au = self._au[self._index(i)]
        # x is far from the boundary, compared to ub - lb
        if x < lb - 2 * al - (ub - lb) / 2.0 or x > ub + 2 * au + (ub - lb) / 2.0:
            r = 2 * (ub - lb + al + au)  # period
            s = lb - 2 * al - (ub - lb) / 2.0  # start
            x -= r * ((x - s) // r)  # shift
        if x > ub + au:
            x -= 2 * (x - ub - au)
        if x < lb - al:
            x += 2 * (lb - al - x)
        return x
915898
public static boolean checkSubtract(INDArray first, INDArray second, double maxRelativeDifference,
                    double minAbsDifference) {
        RealMatrix rmFirst = convertToApacheMatrix(first);
        RealMatrix rmSecond = convertToApacheMatrix(second);

        INDArray result = first.sub(second);
        RealMatrix rmResult = rmFirst.subtract(rmSecond);

        if (!checkShape(rmResult, result))
            return false;
        boolean ok = checkEntries(rmResult, result, maxRelativeDifference, minAbsDifference);
        if (!ok) {
            INDArray onCopies = Shape.toOffsetZeroCopy(first).sub(Shape.toOffsetZeroCopy(second));
            printFailureDetails(first, second, rmResult, result, onCopies, "sub");
        }
        return ok;
    }
851748
def expected_values(early_mean=early_mean,
                    late_mean=late_mean,
                    switchpoint=switchpoint):
    """"""

    # Sample size
    n = len(disasters_array)
    # Expected values
    return concatenate(
        (ones(switchpoint) * early_mean, ones(n - switchpoint) * late_mean))
849735
def recover_dual_variables(self,lam,nu,mu,pi):
        

        return lam,nu,mu,pi
835043
public static Double meanDifference(NumericColumn<?> column1, NumericColumn<?> column2) {
        return StatUtils.meanDifference(column1.asDoubleArray(), column2.asDoubleArray());
    }
361911
public static void FFTShift1D(double[] x, Direction direction) {

        if (x.length == 1)
            return;

        double[] temp = x.clone();
        int move = x.length / 2;

        if (direction == Direction.Forward) {
            int c = 0;
            for (int i = x.length - move; i < x.length; i++)
                x[c++] = temp[i];

            for (int i = 0; i < x.length - move; i++)
                x[c++] = temp[i];

        } else {
            int c = 0;
            for (int i = move; i < x.length; i++)
                x[c++] = temp[i];

            for (int i = 0; i < move; i++)
                x[c++] = temp[i];

        }
    }
516636
function setValue2fm( gl, v ) {

	var cache = this.cache;
	var elements = v.elements;

	if ( elements === undefined ) {

		if ( arraysEqual( cache, v ) ) return;

		gl.uniformMatrix2fv( this.addr, false, v );

		copyArray( cache, v );

	} else {

		if ( arraysEqual( cache, elements ) ) return;

		mat2array.set( elements );

		gl.uniformMatrix2fv( this.addr, false, mat2array );

		copyArray( cache, elements );

	}

}
331986
function doOnlySecond(what, first, second, func) {
  const kErr = -1;

  for (let data of second) {
    if (first.indexOf(data) === kErr) {
      func.call(what, data);
    }
  }
  return first;
}