/* Connects two variables, the value of one being the mean of the
message sent to the other.
15280
function LikelihoodFactor(mean_variable, value_variable, variance) {
      LikelihoodFactor.__super__.constructor.call(this, [mean_variable, value_variable]);
      this.mean = mean_variable;
      this.value = value_variable;
      this.variance = variance;
    }
527711
def _get_value(self, var):
        """"""
        return self._problem._cp.solution.get_values(
            self._problem._variables[var])
1192369
def _send(self, subname, value):
        '''
        '''
        name = self._get_name(self.name, subname)
        self.logger.info('%s: %s', name, value)
        return statsd.Client._send(self, {name: '%s|g' % value})
707966
function checkVariable(variable) {
			getModifyingReferences(variable.references).forEach(function(reference) {
				context.report(
					reference.identifier,
					ProblemMessages.noConstantAssign,
					{
						name: reference.identifier.name
					});
			});
		}
862618
def set_mean(self, col, row, mean):
        
        javabridge.call(self.jobject, "setMean", "(IID)V", col, row, mean)
138549
public static double variance( GrayF64 img , double mean ) {

		if( BoofConcurrency.USE_CONCURRENT ) {
			return ImplImageStatistics_MT.variance(img,mean);
		} else {
			return ImplImageStatistics.variance(img,mean);
		}
	}
915964
private void addMsgs(VarTensor[] msgs, Tensor t, int tf) {
        assert msgs[0].getAlgebra().equals(t.getAlgebra());
        EdgeScores es = EdgeScores.tensorToEdgeScores(t);
        for (VarTensor msg : msgs) {
            LinkVar link = (LinkVar) msg.getVars().get(0);
            double val = es.getScore(link.getParent(), link.getChild());
            msg.addValue(tf, val);
        }
    }
921796
function resolveLinkVariablesObject (link, record) {
    // do substitution on href if defined
    if (typeof link.href === 'string') {
        link.href = resolveVariables(link.href, record)
    }
    // do substitution on title if defined
    if (typeof link.title === 'string') {
        link.title = resolveVariables(link.title, record)
    }
}
728524
function transmit(sensor)
{
    var buffer = "Ping " + count;
    count++;
    console.log("Sending... " + buffer);

    sensor.sendStr(buffer, 3000);
    sensor.setSleep();
}
490789
function VarName(a,b){
	VarName.prototype.__super__.constructor.apply(this,arguments);
	this._splat = b;
}
315531
public ForwardToView with(String varName, Object value) {
        attributes.put(varName,value);
        return this;
    }
450498
function mean( out, x ) {
	var len = x.length,
		i;
	if ( out.length !== len ) {
		throw new Error( 'mean()::invalid input arguments. Input and output matrices must be the same length.' );
	}
	for ( i = 0; i < len; i++ ) {
		out.data[ i ] = MEAN( x.data[ i ] );
	}
	return out;
}
1207710
private function correlate($xo, $x_stats, $yo, $y_stats) {
    $acc = 0;
    for($i = 0; $i < $this->sub; $i++) {
      $acc += ($this->buffers[0][($xo + $i) % $this->size] - $x_stats['mean']) *
        ($this->buffers[1][($yo + $i) % $this->size] - $y_stats['mean']);
    }
    $acc /= $this->sub;
    $stddevs = ($x_stats['stdevs'] * $y_stats['stdevs']);
    return ($stddevs == 0 ? 0 : $acc /$stddevs) ;
  }
432396
function checkVariable(variable) {
            astUtils.getModifyingReferences(variable.references).forEach(reference => {
                context.report({ node: reference.identifier, messageId: "unexpected" });
            });
        }
116623
public static void main(String[] args) {
    Random random = new Random();
    int length = 100;
    double[] A = new double[length];
    double[] B = new double[length];
    double aAvg = 70.0;
    double bAvg = 70.5;
    for (int i = 0; i < length; i++) {
      A[i] = aAvg + random.nextGaussian();
      B[i] = bAvg + random.nextGaussian();
    }
    System.out.println("A has length " + A.length + " and mean " + mean(A));
    System.out.println("B has length " + B.length + " and mean " + mean(B));
    for (int t = 0; t < 10; t++) {
      System.out.println("p-value: " + sigLevelByApproxRand(A, B));
    }
  }
1014340
public void addVar(Var var) {
        int id = var.getId();
        boolean alreadyAdded = (0 <= id && id < vars.size());
        if (alreadyAdded) {
            if (vars.get(id) != var) {
                throw new IllegalStateException("Var id already set, but factor not yet added.");
            }
        } else {  
            // Var was not yet in the factor graph.
            //
            // Check and set the id.
            if (id != -1 && id != vars.size()) {
                throw new IllegalStateException("Var id already set, but incorrect: " + id);
            }
            var.setId(vars.size());
            // Add the Var.
            vars.add(var);

            if (bg != null) { log.warn("Discarding BipartiteGraph. This may indicate inefficiency."); }
            bg = null;
        }
    }
381778
function(x, y) {
  var ip,
    bits,
    arr,
    ip4,
    ip6;
  if (y === undefined) { // handed a string
    arr = x.split('/');
    this.subnet = arr[1];
    ip = arr[0];
  } else {
    this.subnet = y;
    ip = x;
  }


  ip4 = (ip instanceof Address4 ? ip : new Address4(ip));
  ip6 = (ip instanceof Address6 ? ip : new Address6(ip));

  this.v = (ip4.valid ? 4 : (ip6.valid ? 6 : 0));

  if (this.v === 6) {
    bits = 128;
  } else {
    bits = 32;
  }
  ip = makeAddr(ip, this.v);

  this.mask = generateCidrMask(bits, bits - this.subnet - 1);
  this.prefix = generatePrefix(ip, this.mask);
}