feat: upstream APIs for BubbleTeaCI migration (#404, #405)#406
Merged
feat: upstream APIs for BubbleTeaCI migration (#404, #405)#406
Conversation
Design document covering upstream API additions needed for BubbleTeaCI-rs migration: PartialEq for DiscretizedGrid, grid-aware operator constructors, batched TCI, partial site contraction, and Index::Id → Index API unification. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add shift_operator_on_grid_by_tag for Julia-style tag="x" variable selection. Document tag propagation from grid variable names to operator site indices. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9-task bottom-up plan: quanticsgrids PartialEq, grid-aware operators with tag-based variable selection, batched TCI, partial site contraction, and Index-based API unification. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add Index-based wrappers for evaluate and all_site_index_ids that accept T::Index objects directly instead of raw IDs, simplifying downstream usage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add swap_site_indices_by_index and swap_on_edge_by_index as Index-based alternatives accepting T::Index keys instead of T::Index::Id. Includes integration tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add PartialContractionSpec and partial_contract() to tensor4all-treetn, enabling fine-grained control over which index pairs are contracted (summed over) vs. kept as separate output indices during TreeTN contraction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add quanticscrossinterpolate_batched which interpolates vector or tensor-valued functions by running scalar TCI independently per component with shared evaluation caching, then combining the per-component tensor trains into a single block-diagonal TT with a component selector site appended. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add shift_operator_on_grid, shift_operator_on_grid_by_tag, and detect_unfolding_scheme to the quanticstransform crate. These functions accept a DiscretizedGrid and automatically dispatch to the correct implementation based on the grid's unfolding scheme (Grouped, Fused, or Interleaved). - Grouped: concatenates per-variable shift TensorTrains into a single chain - Fused: uses shift_operator_multivar with MPO-MPO composition for multi-variable shifts - Interleaved multi-variable: returns "not yet implemented" error Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add a convenience method that updates both input and output true_index mappings to match a target state's site indices, enabling operators constructed with independent site indices to be applied to arbitrary states without manual mapping rewrite. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add affine_operator_on_grid with Fused/Grouped layout support. Grouped delegates to fused-form for now (TODO: native grouped). Part of #405 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test reveals a limitation where multiply_pairs with shared nodes causes contract() to fail. Marked as ignored pending improved implementation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add validation that contract_pairs and multiply_pairs must target different nodes. When both share a node, replaceind makes all shared indices identical and contract() cannot distinguish them. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix unused imports (IndexLike, TensorIndex) - Fix clippy type_complexity by introducing PartialContractionInputs struct - Add validation tests for dimension mismatch, index not found, contract-only, and empty spec cases to improve coverage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix clippy clone-on-Copy (DynId) in treetn ops tests - Fix clippy needless_range_loop in quanticstransform grid_aware tests - Add coverage tests: topology mismatch, second-network same-node, dimension mismatch, index-not-found, contract-only, empty-spec Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
074b288 to
494f8f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PartialEqforDiscretizedGrid/InherentDiscreteGrid(closes Track PartialEq support for quanticsgrids::DiscretizedGrid #404, in separate quanticsgrids-rs PR)shift_operator_on_grid/affine_operator_on_gridwith Grouped/Fused layout support and tag-based variable selection (shift_operator_on_grid_by_tag)quanticscrossinterpolate_batchedfor vector/tensor-valued functionspartial_contractwithPartialContractionSpecfor selective index contractionLinearOperator::align_to_statefor operator site-index alignmentevaluate_at,all_site_indices,swap_site_indices_by_index)Part of #405.
Design spec
docs/superpowers/specs/2026-04-08-issues-404-405-design.mdKey design decisions
detect_unfolding_scheme()and dispatch internallyshift_operator_on_grid_by_tag) mirrors Julia'sshiftaxismpo(sites, shift; tag="x")conventionpartial_contractvalidates thatcontract_pairsandmultiply_pairstarget different nodes (runtime error otherwise)Index::Id-based methods for Julia ITensor API alignmentTest plan
cargo clippy --workspacecleancargo fmt --allclean🤖 Generated with Claude Code