Conversation
Drops the `FunctionImplementations` and `TypeParameterAccessors` dependencies. TensorAlgebra now owns the shared in-place extension points `zero!` and `scale!` (new `src/inplace.jl`) and the lazy `permuteddims` hook, all declared `public` so downstream array types can overload them without TensorAlgebra depending on a separate package for them. The two small `TypeParameterAccessors` helpers used internally are inlined as thin `Base` wrappers. Also deletes the over-broad `getindex(::AbstractArray, ::AbstractBlockPermutation)` shorthand, which was type piracy and an ambiguity trap with no external users, and rewrites the internal `axes(x)[biperm]` call sites to `blockpermute(...)`. Bumps to 0.10.0.
The matricize contraction does three reshapes: matricize each operand, multiply, then unmatricize the result. These shared a single `fusion_style` field on `Matricize`. Split it into `left_fusion_style` / `right_fusion_style` / `output_fusion_style`, one per reshape position, and route each step through its own style. A single-style constructor copies to all three, so the common symmetric case and existing callers are unchanged. This lets a backend that needs one position to behave differently (the fermionic contraction twist on the second operand in GradedArrays) pick a distinct style at algorithm selection without re-overloading the whole `contractopadd!` routine.
Replaces the catch-all factorization names (`svd`, `svdvals`, `qr`, `lq`, `eigen`, `eigvals`, `polar`, `orth`, `factorize`) at the tensor level with the explicit names MatrixAlgebraKit uses (`svd_compact` / `svd_full` / `svd_trunc` / `svd_vals`, `qr_compact` / `qr_full`, `lq_compact` / `lq_full`, `eigh_full` / `eig_full` / `eigh_trunc` / `eig_trunc` / `eigh_vals` / `eig_vals`). The variant is now in the name rather than behind a `full` / `trunc` / `ishermitian` keyword. These are TensorAlgebra-owned functions taking the codomain/domain partition signature, so they do not pirate MatrixAlgebraKit, and only out-of-place versions are provided. The existing `left_polar` / `right_polar` / `left_orth` / `right_orth` / `left_null` / `right_null` already follow this convention and are unchanged. The `MatrixAlgebra` submodule no longer carries the thin matrix-level wrappers that re-exposed MatrixAlgebraKit under those catch-all names. It keeps only the functionality MatrixAlgebraKit does not provide: `gram_eigh_full` / `gram_eigh_full_with_pinv`, the safe-clamping helpers, and the degenerate-truncation strategy.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #180 +/- ##
==========================================
+ Coverage 81.37% 81.56% +0.18%
==========================================
Files 26 27 +1
Lines 1047 987 -60
==========================================
- Hits 852 805 -47
+ Misses 195 182 -13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mtfishman
added a commit
to ITensor/ITensorBase.jl
that referenced
this pull request
Jun 23, 2026
## Summary Adapts ITensorBase to TensorAlgebra v0.10 and tightens the named-array surface, as one breaking release. Defines ITensorBase's `AbstractITensor` factorizations as overloads of `MatrixAlgebraKit`'s functions (`qr_compact`, `svd_compact`, `left_orth`, and the rest), each forwarding to the matching `TensorAlgebra` array-level method on the unnamed data. This mirrors how `*` on `AbstractITensor` forwards to `TensorAlgebra.contract`: a factorization of a named tensor acts as that factorization on its matricized form, with `TensorAlgebra` handling the matricization. It replaces the previous `LinearAlgebra`-style `svd` / `qr` / `lq` / `eigen` catch-alls, which overloaded `LinearAlgebra` for a type that is not an `AbstractArray`, and adopts the explicit factorization names TensorAlgebra v0.10 exposes (ITensor/TensorAlgebra.jl#180). For `gram_eigh_full` and `gram_eigh_full_with_pinv`, which have no `MatrixAlgebraKit` counterpart, the overloads target `TensorAlgebra.MatrixAlgebra`. Adds `MatrixAlgebraKit` as a direct dependency. Renames the unnamed-array accessors `dename` / `denamed` to `unname` / `unnamed` throughout, including the `Unnamed` type, the `unnamedtype` and `unnamed_prototype` helpers, and internal locals. Makes `length` and `size` of a named array or named unit range return a plain `Int`, and `axes` / `eachindex` return plain unnamed ranges, so the count and positional-index layer match Base and the `AbstractArray` contract that `axes` are `AbstractUnitRange{Int}`. The name stays on the elements (`a[i]`, `first`, `last`, iteration) and on a tensor's named indices via `inds` / `axes(::AbstractITensor)`. This lets `length(::AbstractITensor)` be the plain element count (the product of its size), which previously errored. Bumps to 0.7.0 and requires TensorAlgebra 0.10.
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
Bumps TensorAlgebra to 0.10.0, a breaking release that prepares it for the General registry and reworks two pieces of the interface.
Drops the
FunctionImplementationsandTypeParameterAccessorsdependencies, the only two things keeping TensorAlgebra out of the General registry. TensorAlgebra now owns the shared in-place extension pointszero!andscale!and the lazypermuteddimshook, declaredpublicso downstream array types can overload them directly. The two smallTypeParameterAccessorshelpers used internally are inlined as thinBasewrappers. Also removes the over-broadgetindex(::AbstractArray, ::AbstractBlockPermutation)shorthand, which was type piracy and an ambiguity trap with no external users, in favor of the existingblockpermute.Gives the
Matricizecontraction algorithm three fusion styles (left_fusion_style,right_fusion_style,output_fusion_style), one for each reshape position, instead of a single shared one. A single-style constructor copies to all three, so the symmetric common case and existing callers are unchanged. This lets a backend that needs one position to behave differently (the fermionic contraction twist on the second operand in GradedArrays) pick a distinct style at algorithm selection without re-overloading the whole routine.Switches the tensor-level factorizations from the catch-all names (
svd,qr,lq,eigen,eigvals,svdvals,polar,orth,factorize) to the explicit names MatrixAlgebraKit uses (svd_compact,svd_full,svd_trunc,qr_compact,qr_full,eigh_full,eig_full, and the rest), so the variant lives in the name rather than behind afull,trunc, orishermitiankeyword. These are TensorAlgebra-owned functions taking the codomain/domain partition signature, out-of-place only. TheMatrixAlgebrasubmodule sheds the matrix-level wrappers that re-exposed those catch-alls and keeps only what MatrixAlgebraKit does not provide (gram_eigh_full, the safe-clamping helpers, the degenerate-truncation strategy).