Skip to content

feature: TensorTrain <-> TreeTN conversion API #360

@shinaoka

Description

@shinaoka

Description

There is no public API to convert between TensorTrain<Complex64> (simplett) and TreeTN<TensorDynLen, usize> (treetn). This is the single largest usability barrier for the quanticstransform crate.

Every user who wants to apply a quantics operator must write ~100 lines of boilerplate to:

  1. Convert TensorTrain to TreeTN (construct TensorDynLen with column-major layout, handle boundary tensors, create Index objects)
  2. Remap site indices to match operator input indices via get_input_mapping
  3. Apply the operator
  4. Extract results from the output TreeTN

The integration test (crates/tensor4all-quanticstransform/tests/integration_test.rs) contains helper functions (tensortrain_to_treetn, contract_treetn_to_vector) that are copy-pasted by every user.

Additional gaps

  • No TensorTrain<f64> -> TensorTrain<Complex64> conversion (TCI produces f64, operators require Complex64)
  • No QuanticsOperator re-export from quanticstransform lib.rs

Suggested API

// In tensor4all-treetn or a bridging crate:
pub fn tensortrain_to_treetn(tt: &TensorTrain<Complex64>) -> (TreeTN<TensorDynLen, usize>, Vec<Index>);

// High-level convenience:
pub fn apply_operator_to_tensortrain(op: &QuanticsOperator, tt: &TensorTrain<Complex64>) -> Result<TensorTrain<Complex64>>;

Found by

Reported by 5 out of 6 automated test personas as the primary friction point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions