variable_set.c File Reference Detailed DescriptionImplementation of the functions operating on box Tvariable_set.
Definition in file variable_set.c.
Function Documentation
Adds a variable index with a given power to a variable set. Private function used by different public functions.
Definition at line 36 of file variable_set.c. References Tvariable_set::fun, Tvariable_set::maxvars, MEM_DUP, MEM_EXPAND, Tvariable_set::nvars, Tvariable_set::power, SWAP, and Tvariable_set::var_id. Referenced by AddVariable2Set(), and UnionVarSet().
Creates an empty set of variable indexes.
Definition at line 70 of file variable_set.c. References Tvariable_set::fun, INIT_NUM_VARIABLES, Tvariable_set::maxvars, NEW, Tvariable_set::nvars, Tvariable_set::power, and Tvariable_set::var_id. Referenced by CopyEquation(), DeriveEquation(), InitEquation(), InitMonomial(), and ReplaceVariableInVarSet().
Removes the information stored in a variable set (variable identifiers and powers) but not the allocated memory. To re-use a Tvariable_set it is more efficient to reset the variable to re-use instead of deleting it and constructing a new set.
Definition at line 79 of file variable_set.c. References Tvariable_set::nvars. Referenced by AddScaledMonomial(), DeriveVarSet(), ResetEquation(), ResetMonomial(), and VarScaleEquation().
Creates a set of variable from the informatin stored in another set.
Definition at line 84 of file variable_set.c. References Tvariable_set::fun, Tvariable_set::maxvars, NEW, Tvariable_set::nvars, Tvariable_set::power, and Tvariable_set::var_id. Referenced by CopyMonomial(), ProductVarSet(), and ReplaceVariableInVarSet().
When eliminating a variable from a problem, the indexes of the variables with an identifier above the removed varaible need to be decreased by one. This function performs this opearation for a single variable set. The variable that we are removing from the problem need to be removed before applying this operation. If the variable set still includes the variable to be removed this function triggers and error.
Definition at line 99 of file variable_set.c. References Error(), Tvariable_set::nvars, and Tvariable_set::var_id. Referenced by FixVariableInMonomial(), ReplaceVariableInEquation(), and ReplaceVariableInMonomial().
Compare two given variable sets. Variable sets are compared first taking into account the numver of indexes they include, then the powers of the variables and, finally, the indexes of the variables.
Definition at line 112 of file variable_set.c. References Tvariable_set::fun, Tvariable_set::nvars, Tvariable_set::power, and Tvariable_set::var_id. Referenced by CmpMonomial(), and FindMonomial().
Checks if a variable set is empty.
Definition at line 148 of file variable_set.c. References Tvariable_set::nvars. Referenced by PrintMonomial().
Identifies variable sets formed only by products of variables, i.e. without functions in the variables.
Definition at line 153 of file variable_set.c. References FALSE, Tvariable_set::fun, and NFUN. Referenced by BilinearMonomial(), LinearMonomial(), PolynomialMonomial(), and QuadraticMonomial().
Gets the position of a variable index in a set of variable indexes.
Definition at line 165 of file variable_set.c. References FALSE, NO_UINT, and Tvariable_set::var_id. Referenced by ReplaceVariableInEquation(), and VarIncluded().
Determines if a variable index is included in a set of variable indexes.
Definition at line 183 of file variable_set.c. References GetPlaceinSet(), and NO_UINT. Referenced by CSRemoveUnusedVars(), DeriveMonomial(), RemoveEquationsWithVar(), UsedVarInEquations(), and UsedVarInNonDummyEquations().
Determines if a variable index is included in a set of variable indexes with a given power and function.
Definition at line 188 of file variable_set.c. References FALSE, Tvariable_set::fun, Tvariable_set::power, and Tvariable_set::var_id. Referenced by VarSetIntersect().
Determines if two variable sets have any element in common. To determine if two variable set elements are the same we take into account bot the variable index, its power, and its associated function (if any).
Definition at line 205 of file variable_set.c. References FALSE, Tvariable_set::fun, Included(), Tvariable_set::power, and Tvariable_set::var_id.
Produces a variable set that is the union of two variable sets: i.e., it includes the variables in both sets.
Definition at line 221 of file variable_set.c. References AddVariableInt(), FALSE, Tvariable_set::fun, Tvariable_set::nvars, Tvariable_set::power, and Tvariable_set::var_id. Referenced by AddScaledMonomial(), and VarScaleEquation().
Adds a variable index with a given power to a variable set.
Definition at line 265 of file variable_set.c. References AddVariableInt(), FALSE, Tvariable_set::fun, Tvariable_set::power, and Tvariable_set::var_id. Referenced by AddVariable2Monomial(), ProductVarSet(), and ReplaceVariableInVarSet().
Accumulates two variable sets in one. Note that this is different from UnionVarSet since here we keep the sum of the exponentionals (not the maximum one).
Definition at line 282 of file variable_set.c. References AddVariable2Set(), CopyVarSet(), Tvariable_set::fun, Tvariable_set::nvars, Tvariable_set::power, and Tvariable_set::var_id. Referenced by MonomialProduct().
Removes a variable index from a variable set. This operates indepedently of the function/power applied to the variable.
Definition at line 305 of file variable_set.c. References Tvariable_set::fun, Tvariable_set::nvars, Tvariable_set::power, and Tvariable_set::var_id.
Replaces a variable by a constant.
Definition at line 323 of file variable_set.c. References COSV, dSEC2TANV, Error(), EXPV, Tvariable_set::fun, NFUN, Tvariable_set::nvars, Tvariable_set::power, PWCV, PWLV, PWPV, SEC2TANV, SEC2V, SINV, TANV, Tvariable_set::var_id, and ZERO. Referenced by FixVariableInMonomial().
Replaces a variable by a scaled variable. Note that variables inside functions can only be replaced with a scale factor set to 1.
Definition at line 405 of file variable_set.c. References AddVariable2Set(), CopyVarSet(), DeleteVarSet(), Error(), Tvariable_set::fun, InitVarSet(), NFUN, Tvariable_set::nvars, Tvariable_set::power, and Tvariable_set::var_id. Referenced by ReplaceVariableInMonomial().
Returns the order of a variable set: the sum of the powers of the variables in the set.
Definition at line 430 of file variable_set.c. References Tvariable_set::nvars, and Tvariable_set::power. Referenced by MonomialOrder().
Returns the number of elements of a variable set.
Definition at line 449 of file variable_set.c. References Tvariable_set::nvars. Referenced by BilinearMonomial(), CropEquation(), CtMonomial(), DummifyAndAddEquation(), EvaluateMonomial(), EvaluateMonomialInt(), GetBoxMaxSizeVarSet(), GetBoxMinSizeVarSet(), GetEquationNumVariables(), IsSimplificable(), LinearMonomial(), QuadraticMonomial(), ReplaceVariableInEquation(), RewriteEquation2Orig(), RewriteEquation2Simp(), and SetEquationInfo().
Returns the identifier for the n-th variable in the set. If the set has less than n elements this functions triggers an error.
Definition at line 454 of file variable_set.c. References Error(), and Tvariable_set::var_id. Referenced by CropEquation(), DummifyAndAddEquation(), ErrorDueToVariable(), GetBoxMaxSizeVarSet(), GetBoxMinSizeVarSet(), GetFirstOrderApproximationToEquation(), IsSimplificable(), LinearEquation2LinearConstraint(), LinearizeBilinealMonomialEquation(), LinearizeCircleEquation(), LinearizeGeneralEquation(), LinearizeParabolaEquation(), LinearizeSaddleEquation(), LinearizeSphereEquation(), RewriteEquation2Orig(), RewriteEquation2Simp(), SetEquationInfo(), and UpdateSplitWeight().
Returns the variable identifiers stored in a variable set.
Definition at line 465 of file variable_set.c. References Tvariable_set::var_id.
Returns the power for the n-th variable in the set. If the set has less than n elements this functions triggers an error.
Definition at line 470 of file variable_set.c. References Error(), and Tvariable_set::power. Referenced by BilinearMonomial(), DummifyAndAddEquation(), LinearMonomial(), QuadraticMonomial(), ReplaceVariableInEquation(), and RewriteEquation2Orig().
Returns the function applied to the n-th variable in the set. If the set has less than n elements this functions triggers an error.
Definition at line 481 of file variable_set.c. References Error(), and Tvariable_set::fun. Referenced by DummifyAndAddEquation(), RewriteEquation2Orig(), and RewriteEquation2Simp().
Returns the variable powers stored in a variable set.
Definition at line 492 of file variable_set.c. References Tvariable_set::power.
Evaluates a variable set for a given set of value for the variables.
Definition at line 497 of file variable_set.c. References COSV, dSEC2TANV, Error(), EXPV, Tvariable_set::fun, NFUN, Tvariable_set::nvars, Tvariable_set::power, PWCV, PWLV, PWPV, SEC2TANV, SEC2V, SINV, TANV, Tvariable_set::var_id, and ZERO. Referenced by EvaluateMonomial().
Evaluates a variable set for a given set of ranges for the variables using interval arithmetics.
Definition at line 578 of file variable_set.c. References CopyInterval(), COSV, dSEC2TANV, Error(), EXPV, Tvariable_set::fun, IntervalCosine(), IntervalExp(), IntervalPow(), IntervalProduct(), IntervalScale(), IntervalSecant2(), IntervalSecant2Tangent(), IntervalSine(), IntervalTangent(), LowerLimit(), NewInterval(), NFUN, Tvariable_set::nvars, Tvariable_set::power, PWCV, PWLV, PWPV, SEC2TANV, SEC2V, SINV, TANV, UpperLimit(), and Tvariable_set::var_id. Referenced by EvaluateMonomialInt().
Derives a variable set with respect to a given variable.
Definition at line 674 of file variable_set.c. References COSV, dSEC2TANV, Error(), EXPV, FALSE, Tvariable_set::fun, Tvariable_set::maxvars, NEW, NFUN, Tvariable_set::nvars, Tvariable_set::power, PWCV, PWLV, PWPV, ResetVarSet(), SEC2TANV, SEC2V, SINV, TANV, TRUE, and Tvariable_set::var_id. Referenced by DeriveMonomial().
Writes a variable set to a given stream.
Definition at line 794 of file variable_set.c. References COSV, dSEC2TANV, Error(), EXPV, FALSE, Tvariable_set::fun, NFUN, Tvariable_set::nvars, Tvariable_set::power, PRINT_VARIABLE_NAME, PWCV, PWLV, PWPV, SEC2TANV, SEC2V, SINV, TANV, TRUE, and Tvariable_set::var_id. Referenced by PrintMonomial().
Deletes the information stored in the variable set and frees the allocated memory space.
Definition at line 876 of file variable_set.c. References Tvariable_set::fun, Tvariable_set::power, and Tvariable_set::var_id. Referenced by DeleteEquation(), DeleteMonomial(), and ReplaceVariableInVarSet(). |
Follow us!