Skip to main content

build_identity_operator_tensor

Function build_identity_operator_tensor 

Source
pub fn build_identity_operator_tensor(
    site_indices: &[DynIndex],
    output_site_indices: &[DynIndex],
) -> Result<TensorDynLen>
Expand description

Build an identity operator tensor for a gap node.

For a node with site indices {s1, s2, ...} and bond indices {l1, l2, ...}, this creates an identity tensor where:

  • Each site index s gets a primed version s' (output index)
  • The tensor is diagonal: T[s1, s1', s2, s2', ...] = δ_{s1,s1'} × δ_{s2,s2'} × ...

This is a convenience wrapper around TensorDynLen::delta().

§Arguments

  • site_indices - The site indices at this node
  • output_site_indices - The output (primed) site indices, must have same dimensions

§Returns

A tensor representing the identity operator on the given site space.

§Example

For a single site index of dimension 2:

T[s, s'] = δ_{s,s'} = [[1, 0], [0, 1]]