Goes through the token lists and adds all the variables which can be used to define a sub-matrix.  If anything
else is found an excpetion is thrown
485008
private void addSubMatrixVariables(List<TokenList.Token> inputs, List<Variable> variables) {
        for (int i = 0; i < inputs.size(); i++) {
            TokenList.Token t = inputs.get(i);
            if( t.getType() != Type.VARIABLE )
                throw new ParseError("Expected variables only in sub-matrix input, not "+t.getType());
            Variable v = t.getVariable();
            if( v.getType() == VariableType.INTEGER_SEQUENCE || isVariableInteger(t) ) {
                variables.add(v);
            } else {
                throw new ParseError("Expected an integer, integer sequence, or array range to define a submatrix");
            }
        }
    }
940821
public static void add(DMatrixD1 a , double val ) {
        final int length = a.getNumElements();

        for( int i = 0; i < length; i++ ) {
            a.plus(i, val);
        }
    }
153111
def add_variables(vars)
      objective_buffer = build_pointer_array vars.map(&:coefficient), :double
      lb_buffer = build_pointer_array vars.map(&:lower_bound), :double
      ub_buffer = build_pointer_array vars.map(&:upper_bound), :double
      type_buffer = build_pointer_array(vars.map do |var|
        gurobi_type(var.type)
      end, :char)
      names_buffer = build_pointer_array array_to_pointers_to_names(vars),
                                         :pointer

      ret = Gurobi.GRBaddvars @ptr, vars.length, 0, nil, nil, nil,
                              objective_buffer, lb_buffer, ub_buffer,
                              type_buffer, names_buffer

      fail if ret != 0

      # Store all the variables in the model
      vars.each { |var| store_variable var }

      # Update the model with variables so constraint adds succeed
      ret = Gurobi.GRBupdatemodel @ptr
      fail if ret != 0
    end
928010
private void fillOsubMatrix( Coordinate[] controlPoints, GeneralMatrix L ) {
        int controlPointsNum = controlPoints.length;
        for( int i = controlPointsNum; i < (controlPointsNum + 3); i++ ) {
            for( int j = controlPointsNum; j < (controlPointsNum + 3); j++ ) {
                L.setElement(i, j, 0);
            }
        }
    }
1368873
public void setMatrix(int i0, int i1, int j0, int j1, Matrix X)
    {
        try
        {
            for (int i = i0; i <= i1; i++)
            {
                for (int j = j0; j <= j1; j++)
                {
                    A[i][j] = X.get(i - i0, j - j0);
                }
            }
        }
        catch (ArrayIndexOutOfBoundsException e)
        {
            throw new ArrayIndexOutOfBoundsException("Submatrix indices");
        }
    }
816270
private void addFreeVar(VarSymbol v) {
            for (List<VarSymbol> l = fvs; l.nonEmpty(); l = l.tail)
                if (l.head == v) return;
            fvs = fvs.prepend(v);
        }
1334068
private void addTokens(List<AnalyzedToken> taggedTokens, List<AnalyzedToken> l) {
    if (taggedTokens != null) {
      for (AnalyzedToken at : taggedTokens) {
        l.add(at);
      }
    }
  }
1335368
def add_output_variable(self, var):
        """"""
        assert(isinstance(var, Variable))
        self.output_variable_list.append(var)
1235359
private void initialiseInstanceVariables() {
		backing = new HashMap<>();
		booleanBacking = new HashSet<>();
		locations = new HashMap<>();

		// subContextCache is updated on the fly so ensure no concurrent modification.
		subcontextCache = Collections.synchronizedMap(new HashMap());
		runtimeProperties = new IncludeProperties("Runtime: added at runtime");
	}
490540
def add_variables(vars)
      # Allocate space for the new variables
      ret = LPSolve.resize_lp(@ptr, @constraints.length,
                              @variables.length + vars.length)
      fail if ret != 1

      # Store all the variables in the model
      vars.each { |var| store_variable var }
    end
1206551
public void setMatrix(int[] r, int[] c, Matrix X)
    {
        try
        {
            for (int i = 0; i < r.length; i++)
            {
                for (int j = 0; j < c.length; j++)
                {
                    A[r[i]][c[j]] = X.get(i, j);
                }
            }
        }
        catch (ArrayIndexOutOfBoundsException e)
        {
            throw new ArrayIndexOutOfBoundsException("Submatrix indices");
        }
    }
839102
private void fillPsubMatrix( Coordinate[] controlPoints, GeneralMatrix L ) {
        int controlPointsNum = controlPoints.length;
        for( int i = 0; i < controlPointsNum; i++ ) {
            L.setElement(i, i, 0);

            L.setElement(i, controlPointsNum + 0, 1);
            L.setElement(i, controlPointsNum + 1, controlPoints[i].x);
            L.setElement(i, controlPointsNum + 2, controlPoints[i].y);

            L.setElement(controlPointsNum + 0, i, 1);
            L.setElement(controlPointsNum + 1, i, controlPoints[i].x);
            L.setElement(controlPointsNum + 2, i, controlPoints[i].y);
        }
    }
1321172
private void fillKsubMatrix( Coordinate[] controlPoints, GeneralMatrix L ) {
        double alfa = 0;
        int controlPointsNum = controlPoints.length;
        for( int i = 0; i < controlPointsNum; i++ ) {
            for( int j = i + 1; j < controlPointsNum; j++ ) {
                double u = calculateFunctionU(controlPoints[i], controlPoints[j]);
                L.setElement(i, j, u);
                L.setElement(j, i, u);
                alfa = alfa + (u * 2); // same for upper and lower part
            }
        }

        alfa = alfa / (controlPointsNum * controlPointsNum);
    }
472929
def _append(lst, indices, value):
    
    for i, idx in enumerate(indices):
        # We need to loop because sometimes indices can increment by more than 1 due to missing tokens.
        # Example: Sentence with no words after filtering words.
        while len(lst) <= idx:
            # Update max counts whenever a new sublist is created.
            # There is no need to worry about indices beyond `i` since they will end up creating new lists as well.
            lst.append([])
        lst = lst[idx]

    # Add token and update token max count.
    lst.append(value)
1197895
void addToOutputVar(PyExpr pyExpr) {
    boolean isList = pyExpr instanceof PyListExpr;
    if (isList && !getOutputVarIsInited()) {
      appendLine(getOutputVarName(), " = ", pyExpr.getText());
    } else {
      initOutputVarIfNecessary();
      String function = isList ? ".extend(" : ".append(";
      appendLine(getOutputVarName(), function, pyExpr.getText(), ")");
    }
    setOutputVarInited();
  }
772313
def add_variable(self, name):
        """"""
        if name in self._variables:
            raise ValueError(
                "A variable named " + name + " already exists."
            )
        self._variables[name] = len(self._variables)
        self.bounds[name] = (0, None)

        new_col = np.zeros(shape=[len(self._constraints), 1])
        self._add_col_to_A(new_col)
        self._reset_solution()
1227112
def _rebind_variables(self, new_inputs):
        
        expr = self._expr

        # If we have 11+ variables, some of our variable names may be
        # substrings of other variable names. For example, we might have x_1,
        # x_10, and x_100. By enumerating in reverse order, we ensure that
        # every variable name which is a substring of another variable name is
        # processed after the variable of which it is a substring. This
        # guarantees that the substitution of any given variable index only
        # ever affects exactly its own index. For example, if we have variables
        # with indices going up to 100, we will process all of the x_1xx names
        # before x_1x, which will be before x_1, so the substitution of x_1
        # will not affect x_1x, which will not affect x_1xx.
        for idx, input_ in reversed(list(enumerate(self.inputs))):
            old_varname = "x_%d" % idx
            # Temporarily rebind to x_temp_N so that we don't overwrite the
            # same value multiple times.
            temp_new_varname = "x_temp_%d" % new_inputs.index(input_)
            expr = expr.replace(old_varname, temp_new_varname)
        # Clear out the temp variables now that we've finished iteration.
        return expr.replace("_temp_", "_")