Mix starting with x2, mixing mixing, going towards x1.
4809
def mix(x1,
        x2,
        steps,
        is_training,
        min_prob=0.0,
        max_prob=1.0,
        mode="lin",
        simple=False,
        broadcast_last=False):
  """"""
  with tf.name_scope("mix"):
    if not is_training:
      if max_prob >= 1.0:
        return x1
      alpha_shape = shape_list(x1)
      if broadcast_last:
        alpha_shape = alpha_shape[:-1] + [1]
      alpha = tf.random_uniform(alpha_shape)
      alpha = to_float(tf.less(alpha, max_prob))
      return alpha * x1 + (1.0 - alpha) * x2

    def get_res():
      """Create the result.

      Separate function to speed it up later (see below).

      Returns:
        Tensor of mixed inputs.
      """
      if mode == "lin":
        alpha_p = inverse_lin_decay(steps)
      else:
        alpha_p = inverse_exp_decay(steps)
      alpha_p = alpha_p * (max_prob - min_prob) + min_prob
      if simple:
        return alpha_p * x1 + (1.0 - alpha_p) * x2
      alpha_shape = shape_list(x1)
      if broadcast_last:
        alpha_shape = alpha_shape[:-1] + [1]
      alpha = tf.random_uniform(alpha_shape)
      alpha = to_float(tf.less(alpha, alpha_p))
      return alpha * x1 + (1.0 - alpha) * x2

    if max_prob < 1.0:
      return get_res()

    # Prevent sampling after steps is passed to speed it up.
    if is_xla_compiled():
      return get_res()
    else:
      cur_step = tf.train.get_global_step()
      if cur_step is None:
        return x1  # Step not available, probably eval mode, don't mix.
      return tf.cond(tf.less(cur_step, steps), get_res, lambda: x1)
479995
def demix2(servo1, servo2, gain=0.5):
    ''''''
    s1 = servo1 - 1500
    s2 = servo2 - 1500
    out1 = (s1+s2)*gain
    out2 = (s1-s2)*gain
    return out2+1500
775136
def demix1(servo1, servo2, gain=0.5):
    ''''''
    s1 = servo1 - 1500
    s2 = servo2 - 1500
    out1 = (s1+s2)*gain
    out2 = (s1-s2)*gain
    return out1+1500
728840
function mixChain()
{
  var args = Array.prototype.slice.call(arguments)
    , i    = args.length
    ;

  while (--i > 0)
  {
    args[i-1].__proto__ = args[i];
  }

  return args[i];
}
65993
private void hashMix() {
       a = subtract(a, b); a = subtract(a, c); a = xor(a, c >> 13);
       b = subtract(b, c); b = subtract(b, a); b = xor(b, leftShift(a, 8));
       c = subtract(c, a); c = subtract(c, b); c = xor(c, (b >> 13));
       a = subtract(a, b); a = subtract(a, c); a = xor(a, (c >> 12));
       b = subtract(b, c); b = subtract(b, a); b = xor(b, leftShift(a, 16));
       c = subtract(c, a); c = subtract(c, b); c = xor(c, (b >> 5));
       a = subtract(a, b); a = subtract(a, c); a = xor(a, (c >> 3));
       b = subtract(b, c); b = subtract(b, a); b = xor(b, leftShift(a, 10));
       c = subtract(c, a); c = subtract(c, b); c = xor(c, (b >> 15));
     }
48672
function mixin$1(name, mix, g) {
  // Unnamed global
  if (isObject(name)) {
    mixin$1(("__" + (mixins_id++) + "__"), name, true);
    return
  }

  var store = g ? globals : mixins;

  // Getter
  if (!mix) {
    if (isUndefined(store[name]))
      { throw new Error(("Unregistered mixin: " + name)) }

    return store[name]
  }

  // Setter
  store[name] = isFunction(mix) ?
    extend(mix.prototype, store[name] || {}) && mix :
    extend(store[name] || {}, mix);
}
620425
def mix_c!(i, j, c = nil)
      @body.mix_c!(i, j, c)
      @right.mix_c!(i, j, c)
      self
    end
1164261
def mixing_phases(U):
    """"""
    f = {}
    # angles
    f['t13'] = asin(abs(U[0,2]))
    if U[0,0] == 0:
        f['t12'] = pi/2
    else:
        f['t12'] = atan(abs(U[0,1])/abs(U[0,0]))
    if U[2,2] == 0:
        f['t23'] = pi/2
    else:
        f['t23'] = atan(abs(U[1,2])/abs(U[2,2]))
    s12 = sin(f['t12'])
    c12 = cos(f['t12'])
    s13 = sin(f['t13'])
    c13 = cos(f['t13'])
    s23 = sin(f['t23'])
    c23 = cos(f['t23'])
    # standard phase
    if (s12*s23) == 0 or (c12*c13**2*c23*s13) == 0:
        f['delta'] = 0
    else:
        f['delta'] = -phase((U[0,0].conj()*U[0,2]*U[2,0]*U[2,2].conj()/(c12*c13**2*c23*s13) + c12*c23*s13)/(s12*s23))
    # Majorana phases
    f['delta1']  = phase(exp(1j*f['delta']) * U[0, 2])
    f['delta2']  = phase(U[1, 2])
    f['delta3']  = phase(U[2, 2])
    f['phi1'] = 2*phase(exp(1j*f['delta1']) * U[0, 0].conj())
    f['phi2'] = 2*phase(exp(1j*f['delta1']) * U[0, 1].conj())
    return f
80282
function createCombinations(a, b) {
  var combinations = [''];
  var newCombinations;
  for (var i = 0, len = a.length; i < len; i += 1) {
    newCombinations = [];
    combinations.forEach(function (combination) {
      newCombinations.push(combination + a[i]);
      // Don't repeat work.
      if (a[i] !== b[i]) {
        newCombinations.push(combination + b[i]);
      }
    });
    combinations = newCombinations;
  }
  return combinations;
}
126564
function() {
		if(this.init) { this.init.apply(this, arguments) }
		for (var i=0, mixin; mixin = mixins[i]; i++) {
			if (mixin.init) { mixin.init.apply(this) }
		}
	}
374843
def cross_product(self, p1, p2):
        """"""
        return (p1.x * p2.y - p1.y * p2.x)
1055629
private Mixer createNewMixer()
	{
		Mixer mixer = getCurrentContainer().createNewMixer();
		if (mixer!=null)
		{
			mixer.setAudioProcessor(audioProcessor);
			mixer.setVolume(currentVolume);
			mixer.setBalance(currentBalance);
			mixer.setSoundOutputStream(getSoundOutputStream());
			getSeekBarPanel().setCurrentMixer(mixer);
		}
		return mixer;
	}
1016141
def _mixup( self, ps ):
        """"""
        for i in range(len(ps) - 1, 0, -1):
            j = int(numpy.random.random() * i)
            temp = ps[i]
            ps[i] = ps[j]
            ps[j] = temp
        return ps
47812
public void initializeMixer()
	{
		// to be a bit faster, we do some precalculations
		calculateGlobalTuning();
		
		// get Mod specific values
		frequencyTableType = mod.getFrequencyTable();
		currentTempo = mod.getTempo();
		currentBPM = mod.getBPMSpeed();
		globalVolume = mod.getBaseVolume();
		globalVolumSlideValue = 0;
		useFastSlides = mod.doFastSlides();
		
		samplePerTicks = calculateSamplesPerTick();
		
		currentTick = currentArrangement = currentRow = patternDelayCount = patternTicksDelayCount = 0;
		currentArrangement = 0;
		currentPatternIndex = mod.getArrangement()[currentArrangement];
		currentPattern = mod.getPatternContainer().getPattern(currentPatternIndex);
		
		patternJumpPatternIndex = patternBreakRowIndex = patternBreakJumpPatternIndex = -1;
		
		modFinished = false;
		
		calculateVolRampLen();
		
		// Reset all rowes played to false
		mod.resetLoopRecognition();

		// Reset FadeOut
		doFadeOut = false;
		fadeOutFac = 8;
		fadeOutValue = 1<<fadeOutFac;
		fadeOutSub = 0x01;
		
		final int nChannels = mod.getNChannels();
		// Now initialize every used channel
		for (int c=0; c<maxChannels; c++)
		{
			channelMemory[c] = new ChannelMemory();
			
			if (c<nChannels)
			{
				final ChannelMemory aktMemo = channelMemory[c];
				aktMemo.panning = mod.getPanningValue(c);
				aktMemo.channelVolume = mod.getChannelVolume(c); 
				initializeMixer(c, aktMemo);
			}
		}
	}
100563
def _multiply(self, x1, x2, out):
        """"""
        self.tspace._multiply(x1.tensor, x2.tensor, out.tensor)
995134
def blockmix_salsa8(BY, Yi, r):
    ''''''

    start = (2 * r - 1) * 16
    X = BY[start:start + 16]                                      # BlockMix - 1

    for i in xrange(0, 2 * r):                                    # BlockMix - 2

        for xi in xrange(0, 16):                                  # BlockMix - 3(inner)
            X[xi] ^= BY[i * 16 + xi]

        salsa20_8(X)                                              # BlockMix - 3(outer)
        aod = Yi + i * 16                                         # BlockMix - 4
        BY[aod:aod + 16] = X[:16]

    for i in xrange(0, r):                                        # BlockMix - 6 (and below)
        aos = Yi + i * 32
        aod = i * 16
        BY[aod:aod + 16] = BY[aos:aos + 16]

    for i in xrange(0, r):
        aos = Yi + (i * 2 + 1) * 16
        aod = (i + r) * 16
        BY[aod:aod + 16] = BY[aos:aos + 16]
159489
public static final int mixMagic(int magic1, int magic2) {
    final long prime = 2654435761L;
    long result = 1;
    result = prime * result + magic1;
    result = prime * result + magic2;
    return (int) result;
  }