pub fn unique_inds<I: IndexLike>(indices_a: &[I], indices_b: &[I]) -> Vec<I>Expand description
Find indices that are unique to the first collection (set difference A \ B).
Returns indices that appear in indices_a but not in indices_b (matched by ID).
This corresponds to ITensors.jl’s uniqueinds function.
§Arguments
indices_a- First collection of indicesindices_b- Second collection of indices
§Returns
A vector containing indices from indices_a that are not in indices_b.
§Example
use tensor4all_core::index::{DefaultIndex as Index, DynId};
use tensor4all_core::index_ops::unique_inds;
let i = Index::new_dyn(2);
let j = Index::new_dyn(3);
let k = Index::new_dyn(4);
let indices_a = vec![i.clone(), j.clone()];
let indices_b = vec![j.clone(), k.clone()];
let unique = unique_inds(&indices_a, &indices_b);
assert_eq!(unique.len(), 1);
assert_eq!(unique[0].id, i.id);