Gets a {@code TableFactor} over {@code vars} which assigns weight 1 to all
assignments. The weights are represented in log space.

@param vars
@return
423960
public static TableFactor logUnity(VariableNumMap vars) {
    TableFactorBuilder builder = new TableFactorBuilder(vars, SparseTensorBuilder.getFactory());
    return builder.buildSparseInLogSpace();
  }
349216
public QueryBuilder<V> withBindVariableValues(Map<String, V> values) {
    valueMap.putAll(values);
    return this;
  }
45361
public static Column var(DataRowsFacade dataFrame, String columnName) {
        return dataFrame.get().groupBy(columnName).agg(functions.variance(columnName)).col(columnName);
    }
87743
private Assignment createAssignment(final LNGBooleanVector vec, final Collection<Variable> variables) {
        final Assignment model = new Assignment();
        for (int i = 1; i < vec.size(); i++) {
            final Variable var = this.f.variable(this.idx2name.get(i));
            if (vec.get(i)) {
                if (variables == null || variables.contains(var)) { model.addLiteral(var); }
            } else if (variables == null || variables.contains(var)) { model.addLiteral(var.negate()); }
        }
        return model;
    }
683076
public void addUnreplicatedFactor(String factorName, T factor, VariableNumMap vars) {
    parametricFactors.add(factor);
    factorPatterns.add(new WrapperVariablePattern(vars));
    parametricFactorNames.add(factorName);
  }
205453
public static<T>  SessionVar<T> vendSessionVar(Callable<T> defFunc) {
	return (new VarsJBridge()).vendSessionVar(defFunc, new Exception());
    }
222740
public static Variable[] getVariables(NameSpace ns, String[] names) {
        if (null == ns || null == names)
            return new Variable[0];
        return Stream.of(names).map(name->getVariable(ns, name))
            .filter(Objects::nonNull).toArray(Variable[]::new);
    }
168382
public static DynamicVariableSet fromVariables(VariableNumMap variables) {
    return new DynamicVariableSet(variables, Collections.<String> emptyList(),
        Collections.<DynamicVariableSet> emptyList(), new int[0]);
  }
1310328
public final Set<Variable> vars() {
        if (vars == null) {
            ImmutableSet.Builder<Variable> builder = ImmutableSet.<Variable>builder().add(start());
            Variable end = end();
            if (end != null) builder.add(end);
            builder.addAll(otherVars());
            vars = builder.build();
        }

        return vars;
    }
23809
public VarSet addMember( IVarDef var)
    {
    assert var != null;
    assert var.getName() != null;

    if( findMember( var.getName()) >= 0)
      {
      throw new IllegalStateException( "Member=" + var.getName() + " already defined for varSet=" + getPathName());
      }

    members_.add( var);
    var.setParent( this);
    var.setSeqNum( getNextSeqNum());

    return this;
    }
175254
public Assignment outcomeToAssignment(String[] factorVariables, Object[] outcome) {
    return outcomeToAssignment(Arrays.asList(factorVariables), Arrays.asList(outcome));
  }
817819
public <T extends ListBuffer<? super JCVariableDecl>> T variableDeclarators(JCModifiers mods,
                                                                         JCExpression type,
                                                                         T vdefs)
    {
        return variableDeclaratorsRest(token.pos, mods, type, ident(), false, null, vdefs);
    }
1177513
private VarDef getNextVarDef()
    {
    if( nextVarDef_ == null)
      {
      // Still traversing current VarSet?
      if( nextVarSet_ != null && nextVarSet_.hasNext())
        {
        // Yes, return next VarSet member.
        nextVarDef_ = nextVarSet_.next();
        }
      else
        {
        // No, get next variable, skipping any empty VarSet.
        nextVarSet_ = null;
        Iterator<IVarDef> members = null;
        IVarDef varDef;
        for( varDef = null;

             varDefs_.hasNext()
               && (members = (varDef = varDefs_.next()).getMembers()) != null
               && !members.hasNext();

             varDef = null);

        nextVarDef_ =
          // No VarDef left to visit?
          varDef == null? null :

          // Next variable is a VarDef?
          members == null? (VarDef) varDef :

          // No, start traversing next VarSet.
          (nextVarSet_ = new VarDefIterator( members)).next();

        }
      }

    return nextVarDef_;
    }
697325
public Assignment mapVariables(Map<Integer, Integer> varMap) {
    int[] newVarNums = new int[vars.length];
    Object[] newValues = new Object[vars.length];

    int numFilled = 0;
    for (int i = 0; i < vars.length; i++) {
      if (varMap.containsKey(vars[i])) {
        newVarNums[numFilled] = varMap.get(vars[i]);
        newValues[numFilled] = values[i];
        numFilled++;
      }
    }
    
    if (numFilled < newVarNums.length) {
      newVarNums = Arrays.copyOf(newVarNums, numFilled);
      newValues = Arrays.copyOf(newValues, numFilled);
    }
    return Assignment.fromUnsortedArrays(newVarNums, newValues);
  }
438228
public function getBindingsAsVars( $vars = array() )
	{
		// $vars = array_merge( $existingVars, $this->parameters );
		$vars = $this->getParametersAsVars( $vars );

		foreach( $this->factVariableBindings as $bindingQName => /** @var \XBRL\Formulas\factVariableBinding $varBinding */ $varBinding )
		{
			if ( $varBinding->isFallback )
			{
				$current = $varBinding->yieldedFact;
			}
			else
			{
				// Using current makes sure the fact is set and the binding variables are correct
				if ( ! $varBinding->valid() ) $varBinding->rewind();
				$current = $varBinding->current();
			}
			if ( $current instanceof XPath2NodeIterator ) $current->Reset();
			$vars[ $bindingQName ] = $current;
			$vars = array_merge( $vars, $varBinding->getAdditionalVars() );
		}

		foreach( $this->generalVariableBindings as $bindingQName => /** @var VariableBinding $varBinding */ $varBinding )
		{
			// Using current makes sure the fact is set and the binding variables are correct
			// $vars[ $bindingQName ] = $this->variablesByQName[ $bindingQName ]->bindAsSequence ? $varBinding->facts : $varBinding->current();
			if ( ! $varBinding->valid() ) $varBinding->rewind();
			$current = $varBinding->current();
			if ( $current instanceof XPath2NodeIterator )
			{
				// BMS 2018-04-04 Test 0023 V-03 fails because the vars are being reset presumably because a var is not a clone
				$current = $current->CloneInstance();
				$current->Reset();
			}
			else if ( $current instanceof XPathNavigator)
			{
				$current = $current->CloneInstance();
			}
			$vars[ $bindingQName ] = $current;
		}

		return $vars;
	}
527444
protected CLVar var(final int lit) {
        final int idx = Math.abs(lit);
        assert 0 < idx && idx < this.vars.size();
        return this.vars.get(idx);
    }
917103
public static FactorGraph createFromFactors(List<Factor> factors) {
    VariableNumMap allVars = VariableNumMap.EMPTY;
    for (int i = 0; i < factors.size(); i++) {
      allVars = allVars.union(factors.get(i).getVars());
    }

    String[] factorNames = new String[factors.size()];
    for (int i = 0; i < factors.size(); i++) {
      factorNames[i] = "factor-" + i;
    }
    return new FactorGraph(allVars, factors.toArray(new Factor[factors.size()]), factorNames,
        VariableNumMap.EMPTY, Assignment.EMPTY, null);
  }