pub fn hascommoninds<I: IndexLike>(indices_a: &[I], indices_b: &[I]) -> boolExpand description
Check if two collections have any common indices (by ID).
This corresponds to ITensors.jl’s hascommoninds function.
§Arguments
indices_a- First collection of indicesindices_b- Second collection of indices
§Returns
true if there is at least one common index (by ID), false otherwise.
§Example
use tensor4all_core::index::{DefaultIndex as Index, DynId};
use tensor4all_core::index_ops::hascommoninds;
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()];
assert!(hascommoninds(&indices_a, &indices_b));
assert!(!hascommoninds(&[i.clone()], &[k.clone()]));