Skip to main content

map_block_structure_to_kkt

Function map_block_structure_to_kkt 

Source
pub fn map_block_structure_to_kkt(
    cls: &BoundClassification,
    var_blocks: &[i32],
    con_blocks: &[i32],
) -> Result<Vec<i32>, String>
Expand description

Turn a model-space block declaration into the KKT-space labels the block solver takes (structured-KKT Phase 5b’s mapper, plan §63.6).

The KKT is laid out [x | slacks | equality duals | inequality duals], so each part inherits a label from what it belongs to:

  • an x column takes its variable’s label — skipping variables fixed out by fixed_variable_treatment, which are not in the KKT at all;
  • a slack and its inequality dual take their constraint’s label;
  • an equality dual takes its constraint’s label.

var_blocks / con_blocks are in the model’s own indexing (n_full_x, n_full_g); negative means shared. Returns the label per KKT index, or an error naming the mismatch — the caller then falls back rather than mislabel, because a label that is off by one row silently declares a structure the matrix does not have.