pub fn apply_local_update_sweep<T, V, U>(
treetn: &mut TreeTN<T, V>,
plan: &LocalUpdateSweepPlan<V>,
updater: &mut U,
) -> Result<()>Expand description
Apply a local update sweep to a TreeTN.
This function orchestrates the sweep by:
- Iterating through the sweep plan
- For each step: a. Validate that the canonical center is a single node within the extracted subtree b. Extract the local subtree c. Call the updater to transform it d. Replace the subtree back into the TreeTN
§Arguments
treetn- The TreeTN to update (modified in place)plan- The sweep plan specifying the update orderupdater- The local updater implementation
§Preconditions
- The TreeTN must be canonicalized with a single-node canonical center
- The canonical center must be within the first step’s nodes
§Returns
Ok(()) if the sweep completes successfully.
§Errors
Returns an error if:
- TreeTN is not canonicalized (canonical_region is empty)
- canonical_region is not a single node
- canonical_region is not within the extracted subtree
- Subtree extraction fails
- The updater returns an error
- Subtree replacement fails