rsr.rsr.refs_mat_to_states

rsr.rsr.refs_mat_to_states(refs_mat, kind)[source]

Convert a binary reference tensor to integer component-state coordinates.

References are stored as binary masks of shape (n_refs, n_var, n_state) in which row i marks the states of component i admitted by the rule (see from_ref_dict_to_mat()). An upper reference >= s marks the suffix s:, so its coordinate is the first admitted state; a lower reference <= s marks the prefix :s+1, so its coordinate is the last admitted state. A component left unconstrained by a rule (all states admitted) therefore maps to 0 for an upper reference and n_state - 1 for a lower one, which is exactly the coordinate that contributes nothing to the corresponding deficit.

Parameters:
  • refs_mat(n_refs, n_var, n_state) binary tensor, or a list of (n_var, n_state) tensors, or an empty container.

  • kind (str) – "upper" or "lower".

Return type:

Tensor

Returns:

(n_refs, n_var) int64 tensor of component-state coordinates.