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
6 changes: 2 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name = "ITensorBase"
uuid = "4795dd04-0d67-49bb-8f44-b89c448a1dc7"
authors = ["ITensor developers <support@itensor.org> and contributors"]
version = "0.4.2"
version = "0.4.3"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
DerivableInterfaces = "6c5e35bf-e59e-4898-b73c-732dcc4ba65f"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MapBroadcast = "ebd9b9da-f48d-417c-9660-449667d60261"
Expand All @@ -20,11 +19,10 @@ VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"
[compat]
Accessors = "0.1.39"
ConstructionBase = "1.6.0"
DerivableInterfaces = "0.5"
FillArrays = "1.13"
LinearAlgebra = "1.10"
MapBroadcast = "0.1.5"
NamedDimsArrays = "0.11.1"
NamedDimsArrays = "0.11.1, 0.12"
Random = "1.10"
TensorAlgebra = "0.3, 0.4, 0.5, 0.6"
UnallocatedArrays = "0.1.1"
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ ITensorBase = {path = ".."}
Documenter = "1"
ITensorBase = "0.4"
Literate = "2"
NamedDimsArrays = "0.11"
NamedDimsArrays = "0.11, 0.12"
2 changes: 1 addition & 1 deletion examples/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ ITensorBase = {path = ".."}
[compat]
ITensorBase = "0.4"
LinearAlgebra = "1.10"
NamedDimsArrays = "0.11"
NamedDimsArrays = "0.11, 0.12"
21 changes: 2 additions & 19 deletions src/abstractitensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ function allocate!(a::AbstractITensor)
return a
end

using DerivableInterfaces: @derive, @interface, AbstractArrayInterface

abstract type AbstractAllocatableArrayInterface{N} <: AbstractArrayInterface{N} end
struct AllocatableArrayInterface{N} <: AbstractAllocatableArrayInterface{N} end
AllocatableArrayInterface{M}(::Val{N}) where {M, N} = AllocatableArrayInterface{N}()
AllocatableArrayInterface(::Val{N}) where {N} = AllocatableArrayInterface{N}()
AllocatableArrayInterface() = AllocatableArrayInterface{Any}()

unallocatable(a::AbstractITensor) = NamedDimsArray(a)

function setindex_allocatable!(a::AbstractArray, value, I...)
Expand All @@ -52,24 +44,15 @@ function setindex_allocatable!(a::AbstractArray, value, I...)
end

# TODO: Combine these by using `Base.to_indices`.
@interface ::AbstractAllocatableArrayInterface function Base.setindex!(
a::AbstractArray, value, I::Int...
)
function Base.setindex!(a::AbstractITensor, value, I::Int...)
setindex_allocatable!(a, value, I...)
return a
end
@interface ::AbstractAllocatableArrayInterface function Base.setindex!(
a::AbstractArray, value, I::AbstractNamedInteger...
)
function Base.setindex!(a::AbstractITensor, value, I::AbstractNamedInteger...)
setindex_allocatable!(a, value, I...)
return a
end

@derive AllocatableArrayInterface() (T = AbstractITensor,) begin
Base.setindex!(::T, ::Any, ::Int...)
Base.setindex!(::T, ::Any, ::AbstractNamedInteger...)
end

mutable struct ITensor <: AbstractITensor
parent::AbstractArray
inds
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ITensorBase = {path = ".."}
Aqua = "0.8.9"
ITensorBase = "0.4"
LinearAlgebra = "1.10"
NamedDimsArrays = "0.11"
NamedDimsArrays = "0.11, 0.12"
SafeTestsets = "0.1"
Suppressor = "0.2"
Test = "1.10"
Loading