Skip to content

Conversation

@shinaoka
Copy link
Member

This PR refactors TensorTrain constructors to:

  • Remove ITensorMPS dependency from constructors by delegating to general constructor
  • Always use MPO decomposition internally (simplified code)
  • Add type constraints for sites parameter
  • Simplify contract() and product() functions
  • Update docstrings to remove internal implementation details

Changes

  • tensortrain.jl: Refactored constructors to delegate to general constructor, added type constraints, updated docstrings
  • contraction.jl: Simplified contract() to always use MPO format, added MPO-like check in product(), added type constraint for alg parameter
  • T4AITensorCompat.jl: Updated imports if needed

… simplify code

- Remove ITensorMPS dependency from TensorTrain constructors
- Delegate to general constructor for TensorTrain(Type, sites) and TensorTrain(Type, sites, linkdims)
- Always use MPO decomposition for TensorTrain(ITensor, sites) and TensorTrain(AbstractArray, sites)
- Add type constraints: sites must be AbstractVector{<:Index} or AbstractVector{<:AbstractVector{<:Index}}
- Simplify contract() to always convert inputs to MPO format
- Add MPO-like check in product() for first argument
- Update docstrings to remove internal implementation details (MPO references)
- Update alg parameter type constraint to Union{String, Algorithm}
@shinaoka shinaoka merged commit 5c33db6 into main Nov 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants