ConicBundle
|
collects modifications for an AffineFunctionTransformation for the scaling and offset constants as well as for appending, deleting or reassigning columns and rows of the transformation data More...
#include <AFTModification.hxx>
Public Member Functions | |
Constructors and initialization | |
AFTModification (CH_Matrix_Classes::Integer var_olddim=0, CH_Matrix_Classes::Integer row_olddim=0, bool ignore_groundset_modification=false) | |
initialize and reset to an unmodified object currently having var_olddim columns and row_olddim rows | |
virtual | ~AFTModification () |
void | clear (CH_Matrix_Classes::Integer var_olddim, CH_Matrix_Classes::Integer row_olddim) |
reset modifications to an unmodified object currently having var_olddim columns and row_olddim rows, calls Modification::clear | |
Routines for adding modifications | |
int | add_append_vars (CH_Matrix_Classes::Integer append_dim, const CH_Matrix_Classes::Sparsemat *append_cols, const CH_Matrix_Classes::Matrix *linear_costs) |
append append_dim new variables/columns with values specified by append_cols (NULL: default value) and linear_costs coefficients (NULL: default value) by calling Modification::add_append_vars | |
int | add_reassign_vars (const CH_Matrix_Classes::Indexmatrix &map_to_old) |
reassign the variables/columns as given in map_to_old, calls Modification::add_reassign_vars | |
int | add_delete_vars (const CH_Matrix_Classes::Indexmatrix &del_ind, CH_Matrix_Classes::Indexmatrix &map_to_old) |
delete the variables indexed by del_ind; for each new index map_to_old returns the old one; calls Modification::add_delete_vars | |
int | add_append_rows (CH_Matrix_Classes::Integer append_dim, const CH_Matrix_Classes::Sparsemat *append_rows, const CH_Matrix_Classes::Matrix *append_rhs) |
append append_dim new rows as in append_rows (if NULL, use default value) with affine offset append_rhs (if NULL use default value 0.), calls Modification::add_append_rows | |
int | add_reassign_rows (const CH_Matrix_Classes::Indexmatrix &map_to_old) |
reassign the rows as given in map_to_old, calls Modification::add_reassign_vars | |
int | add_delete_rows (const CH_Matrix_Classes::Indexmatrix &rows_del_ind, CH_Matrix_Classes::Indexmatrix &rows_map_to_old) |
delete the rows indexed by rows_del_ind; for each new index rows_map_to_old returns the old one; calls Modification::add_delete_rows | |
virtual int | add_apply_factor (CH_Matrix_Classes::Real times_factor) |
multiply the current factor by the value times_factor (>=0, returns 1 if <0.) | |
int | add_offset (CH_Matrix_Classes::Real delta) |
add to the currecnt offset the value delta | |
int | incorporate (const AFTModification &m) |
incorporate the AFTModification m into this one; after factor and offset are dealt with it calls Modification::incorporate | |
Routines for applying the collected modifications | |
int | apply_to_costs (CH_Matrix_Classes::Matrix *&linear_cost) const |
carry out the collected modifications on the given vector by calling Modification::apply_to_vars | |
int | apply_to_rows (CH_Matrix_Classes::Sparsemat *&rows, CH_Matrix_Classes::Matrix *&rhs) const |
carry out the collected modifications on the given data by calling Modification::apply_to_rows (with default value 0. for appended default entries for rhs) | |
int | apply_to_factor (CH_Matrix_Classes::Real &f) const |
multiply f by the factor | |
int | apply_to_offset (CH_Matrix_Classes::Real &o) const |
add to o the offset | |
const CH_Matrix_Classes::Matrix & | apply_modified_transform (CH_Matrix_Classes::Matrix &out_y, const CH_Matrix_Classes::Matrix &in_y, const CH_Matrix_Classes::Sparsemat *arg_trafo, const CH_Matrix_Classes::Matrix *arg_offset) const |
transform the vector as if the Modification had been carried out | |
Routines for querying properties of the collected modifications | |
virtual bool | no_modification () const |
returns true if no modifications need to be executed | |
int | set_append_to_old (bool append_only) |
if set to true, no deletions/reassignments may be present or specified in the future, only appensions are allowed | |
bool | append_to_old () const |
returns true if this only contains appending operations and incorporating this is done with respect to the old dimension | |
virtual bool | only_scalars_change () const |
returns true if linear_cost, matrix and affine rhs offset are not changed | |
virtual bool | ignore_groundset_modification () const |
returns true if groundset_modifications should be ignored | |
virtual bool | groundset_changes_suffice_for_identity () |
returns true if for an AFT with argtrafo==0 the changes in the ground set reflect all modifications | |
bool | preserves_identity () const |
returns true if the modifications are consistent with the AffineFunctionTransformation matrix staying the identity | |
bool | no_additions_or_deletions_in_vars () const |
returns true if no columns/variables were added or deleted (allows permutations), false otherwise | |
bool | no_additions_or_deletions_in_rows () const |
returns true if no rows were added or deleted (allows permutations), false otherwise | |
bool | deleted_variables_are_zero (const CH_Matrix_Classes::Matrix &oldpoint) const |
returns true if all entries deleted in oldpoint (must be a vector of length old_vardim()) are 0, false otherwise | |
bool | new_variables_are_zero (const CH_Matrix_Classes::Matrix &newpoint) const |
returns true if all entries in newpoint (must be a vector of length new_vardim()) that correspond to new variables have value 0 and false otherwise | |
bool | mapped_variables_are_equal (const CH_Matrix_Classes::Matrix &newpoint, const CH_Matrix_Classes::Matrix &oldpoint) const |
returns true if the values in newpoint (must be a vector of length new_vardim()) that correspond to old variables match the old values stored in oldpoint (must be a vector of length old_vardim()) and false otherwise | |
Routines implementing the abstract OracleModifcation messages | |
int | get_old_vardim () const |
returns the number of variables before modification | |
int | get_new_vardim () const |
returns the number of variables once all stored modifications have been performed | |
int | get_appended_vardim () const |
returns the number of variables that are appended (due to later reassignmentds they may no longer be located at the end) | |
const int * | get_map_to_old_variables () const |
returns null if there are no index changes, otherwise the Indexmatrix pointed to is a vector whose i-th entry holds the old index of the new i-th variable (injective!), index values exceeding old_vardim() refer to newly appended variables | |
int | incorporate (const OracleModification &m) |
incorporate the OracleModification m (it should only contain variable changes, but this is not checked!) into this one; calls Modification::incorporate | |
OracleModification * | new_initial_oraclemodification (int old_var_dim) const |
returns a new object on the heap, that allows to incorporate this but starts off from a function whose input argument dimension is old_var_dim | |
int | add_append_variables (int append_dim) |
append append_dim further variables at the end of the argument vector (without specifying their effect, they may e.g. be ignored by the function) | |
virtual int | add_reassign_variables (int new_dim, const int *map_to_old_indices) |
reorder and resize the variables as given by the first new_dim entries of map_to_old_indices; each former index may appear at most once in this list, so new_dim < get_new_vardim() | |
Routines for retrieving the detailed collected modifications | |
CH_Matrix_Classes::Integer | old_vardim () const |
returns the number of variables before modification (given on initialization) | |
CH_Matrix_Classes::Integer | new_vardim () const |
returns the number of variables once all stored modifications have been performed | |
CH_Matrix_Classes::Integer | appended_vardim () const |
returns the number of variables that are appended (due to later reassignmentds they may no longer be located at the end) | |
CH_Matrix_Classes::Integer | old_rowdim () const |
returns the number of rows before modification (given on initialization) | |
CH_Matrix_Classes::Integer | new_rowdim () const |
returns the number of rows once all stored modifications have been performed | |
CH_Matrix_Classes::Integer | appended_rowdim () const |
returns the number of rows that are appended (due to later reassignments they may no longer be located at the end) | |
const CH_Matrix_Classes::Indexmatrix * | map_to_old_variables () const |
returns null if there are no index changes, otherwise the Indexmatrix pointed to is a vector whose i-th entry holds the old index of the new i-th variable (injective!), index values exceeding old_vardim() refer to newly appended variables | |
const CH_Matrix_Classes::Indexmatrix * | deleted_var_indices () const |
returns null if there were no deletions, otherwise the Indexmatrix pointed to is a vector holding the deleted old variable indices in increasing order | |
const CH_Matrix_Classes::Indexmatrix * | new_var_indices () const |
returns null if no variables were added, otherwise the Indexmatrix pointed to is a vector holding the new indices of the new variables in increasing order | |
const CH_Matrix_Classes::Indexmatrix * | map_to_old_rows () const |
returns null if there are no index changes, otherwise the Indexmatrix pointed to is a vector whose i-th entry holds the old index of the new i-th row (injective!), index values exceeding old_rowdim() refer to newly appended rows | |
const CH_Matrix_Classes::Indexmatrix * | deleted_row_indices () const |
returns null if there were no deletions, otherwise the Indexmatrix pointed to is a vector holding the deleted old row indices in increasing order | |
const CH_Matrix_Classes::Indexmatrix * | new_row_indices () const |
returns null if no variables were added, otherwise the Indexmatrix pointed to is a vector holding the new indices of the new rows in increasing order | |
CH_Matrix_Classes::Real | get_additional_offset () const |
returns the value to be added to the offset | |
CH_Matrix_Classes::Real | get_additional_factor () const |
returns null if nothing or default values have to be appended, otherwise it points to a sparse matrix whose columns need to be appended to the matrix | |
const CH_Matrix_Classes::Sparsemat * | get_append_cols () const |
returns null if nothing or default values have to be appended, otherwise it points to a sparse matrix whose columns need to be appended to the matrix | |
const CH_Matrix_Classes::Matrix * | get_append_costs () const |
returns null if nothing or default values have to be appended, otherwise it points to a matrix whose entries need to be appended to the cost vector | |
const CH_Matrix_Classes::Sparsemat * | get_append_rows () const |
returns null if nothing or default values have to be appended, otherwise it points to a sparse matrix whose rows need to be appended to the matrix | |
const CH_Matrix_Classes::Matrix * | get_append_rhs () const |
returns null if nothing or default values have to be appended, otherwise it points to a matrix whose rows need to be appended to the argument offset | |
Output settings | |
void | set_out (std::ostream *out=0, int print_level=1) |
see CBout::set_out | |
Public Member Functions inherited from ConicBundle::CBout | |
virtual void | set_cbout (const CBout *cb, int incr=-1) |
Specifies the output level relative to the given CBout class. More... | |
void | clear_cbout () |
reset to default settings (out=0,print_level=1) | |
CBout (const CBout *cb=0, int incr=-1) | |
calls set_cbout | |
CBout (std::ostream *outp, int pl=1) | |
initialize correspondingly | |
CBout (const CBout &cb, int incr=0) | |
copy constructor | |
virtual bool | cb_out (int pl=-1) const |
Returns true if out!=0 and (pl<print_level), pl<0 should be used for WARNINGS and ERRORS only, pl==0 for usual output. | |
std::ostream & | get_out () const |
If cb_out() returned true, this returns the output stream, but it will abort if called with out==0. | |
std::ostream * | get_out_ptr () const |
returns the pointer to the output stream | |
int | get_print_level () const |
returns the print_level | |
virtual int | mfile_data (std::ostream &out) const |
writes problem data to the given outstream | |
Protected Attributes | |
Modification | mdf |
this class provides a restricted interface to this Modification instance where all modifications are organized and stored | |
CH_Matrix_Classes::Real | factor |
multiply the factor by this value | |
CH_Matrix_Classes::Real | offset |
add this value to the offset | |
bool | ignore_gs_mdf |
if *this does not explicitly change the transformation, usually the groundset modifications will be applied in AffineFunctionTransformation::apply_modification(); if this is to be avoided, set ignore_gs_mdf=true. | |
int | preserves_id_flag |
for lazy evaulation, -1 if not yet determined, 0 if false, 1 if true | |
collects modifications for an AffineFunctionTransformation for the scaling and offset constants as well as for appending, deleting or reassigning columns and rows of the transformation data
The matrix modifications are implemented by restricting the possiblities of ConicBundle::Modification, so most routines simply call those of Modification. See the description there for usage and default values (one exception: for the right hand side offset the default value is 0. here).
A somewhat peculiar property of AffineFunctionTransformations is that a NULL matrix is interpreted as the identity. If modifications are consistent with this interpretation (number of rows and columns stays the same and NULL is used for the transformation matrix), the NULL matrix is preserved.