Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ OhMyThreads = "67456a42-1dca-4109-a031-0a68de7e3ad5"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
PtrArrays = "43287f4e-b6f4-7ad1-bb20-aadabca52c3d"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
ScopedValues = "7e506255-f358-4e82-b7e4-beb19740aa63"
Strided = "5e0ebb24-38b0-5f93-81fe-25c709ecae67"
Expand Down Expand Up @@ -63,6 +64,7 @@ OhMyThreads = "0.8.0"
PrecompileTools = "1"
Preferences = "1"
Printf = "1"
PtrArrays = "1.2"
Random = "1"
ScopedValues = "1.3.0"
Strided = "2.6.1"
Expand Down
1 change: 1 addition & 0 deletions src/TensorKit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ using MatrixAlgebraKit

using Dictionaries: Dictionaries, Dictionary, Indices, gettoken, gettokenvalue
using OhMyThreads
using PtrArrays: PtrArray

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we not have used

using TensorOperations.PtrArrays: PtrArray

in order not to have to have PtrArrays as explicit dependency and maintain its compat bounds. Or is this a bad coding pattern?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think that is not the best code pattern, although I do think we have done this in other parts of our codebase as well. Ultimately dependabot will handle the compat entries so it might be fine for now

using ScopedValues
using TimerOutputs: TimerOutputs, TimerOutput, @timeit_debug

Expand Down
7 changes: 4 additions & 3 deletions src/tensors/treetransformers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ of `tsrc` itself; when `conjsrc` is `true` the fusion trees that are transformed
"""
abstract type TreeTransformer end

# `StridedSubblocks` report their storage as the `StridedView` parent type, which is `Memory` there
# `StridedSubblocks` report their storage as the `StridedView` parent type, which is `Memory` there;
# `PtrArray` is the storage of `TensorOperations.ManualAllocator` temporaries
@static if isdefined(Core, :Memory)
const CPUStorage{T} = Union{Array{T}, Memory{T}}
const CPUStorage{T} = Union{Array{T}, Memory{T}, PtrArray{T}}
else
const CPUStorage{T} = Array{T}
const CPUStorage{T} = Union{Array{T}, PtrArray{T}}
end

"""
Expand Down
6 changes: 6 additions & 0 deletions test/tensors/indexmanipulations.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Test, TestExtras
using TensorKit
using TensorKit: type_repr
using TensorOperations: ManualAllocator
using Combinatorics: permutations


Expand Down Expand Up @@ -211,6 +212,11 @@ for V in spacelist
tdst = rand(ComplexF64, braid(space(τ), p, levels))
@test braid!(copy(tdst), τ, p, levels) ≈ braid!(copy(tdst), TensorMap(τ), p, levels)
end
symmetricbraiding && @timedtestset "Permutations: ManualAllocator" begin
t = rand(ComplexF64, V1 ⊗ V2 ⊗ V3 ← V4 ⊗ V5)
p = ((3, 1, 5), (2, 4))
@test permute(t, p; allocator = ManualAllocator()) ≈ permute(t, p)
end
@timedtestset "Adjoint operands: isometry" begin
# independent of the adjoint convention: a wrongly conjugated recoupling matrix U
# would break dot(U * x', U * y) == dot(x', y) whenever U is genuinely complex
Expand Down
Loading