hasinds

Function hasinds 

Source
pub fn hasinds<I: IndexLike>(indices: &[I], targets: &[I]) -> bool
Expand description

Check if a collection contains all of the specified indices (by ID).

This corresponds to ITensors.jl’s hasinds function.

§Arguments

  • indices - Collection of indices to search
  • targets - The indices to look for

§Returns

true if all target indices (by ID) are found, false otherwise.

§Example

use tensor4all_core::index::{DefaultIndex as Index, DynId};
use tensor4all_core::index_ops::hasinds;

let i = Index::new_dyn(2);
let j = Index::new_dyn(3);
let k = Index::new_dyn(4);
let indices = vec![i.clone(), j.clone(), k.clone()];

assert!(hasinds(&indices, &[i.clone(), j.clone()]));
assert!(!hasinds(&indices, &[i.clone(), Index::new_dyn(5)]));