returns the population variance of a set of numbers after discarding the nulls in this set.

@param expr argument
@return var_pop(expr)
12767
public static <T extends Number> WindowOver<T> varPop(Expression<T> expr) {
        return new WindowOver<T>(expr.getType(), SQLOps.VARPOP, expr);
    }
669285
def solve_var(expr, vars):
    """"""
    try:
        return Result(structured.resolve(vars, expr.value), ())
    except (KeyError, AttributeError) as e:
        # Raise a better exception for accessing a non-existent member.
        raise errors.EfilterKeyError(root=expr, key=expr.value, message=e,
                                     query=expr.source)
    except (TypeError, ValueError) as e:
        # Raise a better exception for what is probably a null pointer error.
        if vars.locals is None:
            raise errors.EfilterNoneError(
                root=expr, query=expr.source,
                message="Trying to access member %r of a null." % expr.value)
        else:
            raise errors.EfilterTypeError(
                root=expr, query=expr.source,
                message="%r (vars: %r)" % (e, vars))
    except NotImplementedError as e:
        raise errors.EfilterError(
            root=expr, query=expr.source,
            message="Trying to access member %r of an instance of %r." %
            (expr.value, type(vars)))
40024
Expression getVariable( String name ) {
        for( int i = state.stackIdx - 1; i >= 0; i-- ) {
            Expression variable = state.stack.get( i ).getVariable( name );
            if( variable != null ) {
                return variable;
            }
        }
        if( name.equals( "@arguments" ) ) {
            for( int i = state.stackIdx - 1; i >= 0; i-- ) {
                Scope scope = state.stack.get( i );
                if( scope.parameters != null ) {
                    Operation params = new Operation( scope.mixin, ' ' );
                    for( Expression expr : scope.parameters.values() ) {
                        if( expr.getClass() == Operation.class && scope.parameters.size() == 1 ) {
                            return expr;
                        }
                        params.addOperand( expr );
                    }
                    return params;
                }
            }
        }
        return null;
    }
1208623
def explained_variance(returns, values):
    
    exp_var = 1 - torch.var(returns - values) / torch.var(returns)
    return exp_var.item()
299246
public <V> V getValue() {
        if (values == null || values.isEmpty()) {
            return null;
        }
        return (V)values.get(0);
    }
1185000
protected T2 getValue(String statsType) {
    if (statsType.equals(CodecUtil.STATS_TYPE_MEAN)) {
      return operations.divide1(valueSum, valueN);
    } else if (statsType.equals(CodecUtil.STATS_TYPE_GEOMETRICMEAN)) {
      return operations.exp2(operations.divide2(valueSumOfLogs, valueN));
    } else if (statsType.equals(CodecUtil.STATS_TYPE_STANDARDDEVIATION)) {
      return operations
          .sqrt2(
              operations.divide2(
                  operations.subtract12(valueSumOfSquares,
                      operations.divide1(
                          operations.product11(valueSum, valueSum), valueN)),
                  (valueN - 1)));
    } else if (statsType.equals(CodecUtil.STATS_TYPE_VARIANCE)) {
      return operations
          .divide2(
              operations
                  .subtract12(valueSumOfSquares,
                      operations.divide1(
                          operations.product11(valueSum, valueSum), valueN)),
              (valueN - 1));
    } else if (statsType.equals(CodecUtil.STATS_TYPE_POPULATIONVARIANCE)) {
      return operations
          .divide2(
              operations
                  .subtract12(valueSumOfSquares,
                      operations.divide1(
                          operations.product11(valueSum, valueSum), valueN)),
              valueN);
    } else if (statsType.equals(CodecUtil.STATS_TYPE_QUADRATICMEAN)) {
      return operations.sqrt2(operations.divide1(valueSumOfSquares, valueN));
    } else {
      return null;
    }
  }
527930
public static double var(int[] x) {
        if (x.length < 2) {
            throw new IllegalArgumentException("Array length is less than 2.");
        }

        double sum = 0.0;
        double sumsq = 0.0;
        for (int xi : x) {
            sum += xi;
            sumsq += xi * xi;
        }

        int n = x.length - 1;
        return sumsq / n - (sum / x.length) * (sum / n);
    }
890131
public static Nullness getNullnessValue(
      ExpressionTree expr, VisitorState state, NullnessAnalysis nullnessAnalysis) {
    TreePath pathToExpr = new TreePath(state.getPath(), expr);
    return nullnessAnalysis.getNullness(pathToExpr, state.context);
  }
1374842
public int getFieldExprIndex(final String _expr)
    {
        int ret = -1;
        if (getAllFieldExpr().containsKey(_expr)) {
            final Integer ident = getAllFieldExpr().get(_expr);
            ret = ident.intValue();
        }
        return ret;
    }
539216
@Deprecated
    public ResultSet getResults(Expression<?>... exprs) {
        if (exprs.length > 0) {
            queryMixin.setProjection(exprs);
        }
        return getResults();
    }
1232604
private ISeq<Phenotype<G, C>>
	selectOffspring(final ISeq<Phenotype<G, C>> population) {
		return _offspringCount > 0
			? _offspringSelector.select(population, _offspringCount, _optimize)
			: ISeq.empty();
	}
265726
public static double xbarVariance(TransposeDataCollection sampleDataCollection, AssociativeArray nh, AssociativeArray populationNh) {
        double populationN = Descriptives.sum(populationNh.toFlatDataCollection());
        
        if(populationN<=0) {
            throw new IllegalArgumentException("The populationN parameter must be positive.");
        }
        
        double variance = 0.0;
        
        for(Map.Entry<Object, FlatDataCollection> entry : sampleDataCollection.entrySet()) {
            Object strata = entry.getKey();
            Integer strataPopulation = ((Number)populationNh.get(strata)).intValue();
            Integer strataSample = ((Number)nh.get(strata)).intValue();
        
            if(strataPopulation==null || strataSample==null) {
                throw new IllegalArgumentException("Invalid strata population or sample size.");
            }
            
            double Wh = strataPopulation/populationN;
                
            //this is the formula when we do SimpleRandomSampling in each strata. nevertheless in order to keep our code DRY, instead of writing directly the formula of SimpleRandomSampling here, we will call SimpleRandomSampling xbarVariance function to estimate it.
            //$fh=$nh[$strata]/$populationNh[$strata];
            //$variance+=$Wh*$Wh*SimpleRandomSampling::variance($flatDataCollection)*(1-$fh)/$nh[$strata]; 
            variance+= Wh*Wh* SimpleRandomSampling.xbarVariance(SimpleRandomSampling.variance(entry.getValue()), strataSample, strataPopulation);
        }
        
        return variance;
    }
1019857
public final int pop()
  {

    m_firstFree--;

    int n = m_map[m_firstFree];

    m_map[m_firstFree] = DTM.NULL;

    return n;
  }
816103
private Object eval(ExpressionContext expr) {
    Object res = expr;
    while(res instanceof ExpressionContext)
      res = ((ExpressionContext)res).accept(visitor);
    if(res instanceof LValue)
      res = ((LValue) res).get(expr);
    return res;
  }
558525
public function getDefaultValue(): Node\Expr {
        $factory = new BuilderFactory();

        if ($this->nullable || $this->mixed || $this->class) {
            return $factory->val(null);
        }

        switch ($this->name) {
        case 'array':
            return $factory->val([]);

        case 'bool':
            return $factory->val(false);

        case 'float':
            return $factory->val(0.0);

        case 'int':
            return $factory->val(0);

        case 'string':
            return $factory->val('');

        default:
            return $factory->val(null);
        }
    }
259796
def convert(self, expr):
        
        if expr is True or expr == None or expr is False:
            return expr
        elif is_number(expr):
            return expr
        elif expr == ".":
            return "."
        elif is_variable_name(expr):
            return coalesce(self.dimensions[expr], expr)
        elif is_text(expr):
            Log.error("{{name|quote}} is not a valid variable name", name=expr)
        elif isinstance(expr, Date):
            return expr
        elif is_op(expr, QueryOp):
            return self._convert_query(expr)
        elif is_data(expr):
            if expr["from"]:
                return self._convert_query(expr)
            elif len(expr) >= 2:
                #ASSUME WE HAVE A NAMED STRUCTURE, NOT AN EXPRESSION
                return wrap({name: self.convert(value) for name, value in expr.leaves()})
            else:
                # ASSUME SINGLE-CLAUSE EXPRESSION
                k, v = expr.items()[0]
                return converter_map.get(k, self._convert_bop)(self, k, v)
        elif is_many(expr):
            return wrap([self.convert(value) for value in expr])
        else:
            return expr
673143
public static InsnList pop(int count) {
        Validate.isTrue(count >= 0);
        InsnList ret = new InsnList();
        for (int i = 0; i < count; i++) {
            ret.add(new InsnNode(Opcodes.POP));
        }

        return ret;
    }