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 rowimarks the states of componentiadmitted by the rule (seefrom_ref_dict_to_mat()). An upper reference>= smarks the suffixs:, so its coordinate is the first admitted state; a lower reference<= smarks the prefix:s+1, so its coordinate is the last admitted state. A component left unconstrained by a rule (all states admitted) therefore maps to0for an upper reference andn_state - 1for 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.