@@ -34,14 +34,6 @@ function allocate!(a::AbstractITensor)
3434 return a
3535end
3636
37- using DerivableInterfaces: @derive , @interface , AbstractArrayInterface
38-
39- abstract type AbstractAllocatableArrayInterface{N} <: AbstractArrayInterface{N} end
40- struct AllocatableArrayInterface{N} <: AbstractAllocatableArrayInterface{N} end
41- AllocatableArrayInterface {M} (:: Val{N} ) where {M, N} = AllocatableArrayInterface {N} ()
42- AllocatableArrayInterface (:: Val{N} ) where {N} = AllocatableArrayInterface {N} ()
43- AllocatableArrayInterface () = AllocatableArrayInterface {Any} ()
44-
4537unallocatable (a:: AbstractITensor ) = NamedDimsArray (a)
4638
4739function setindex_allocatable! (a:: AbstractArray , value, I... )
@@ -52,24 +44,15 @@ function setindex_allocatable!(a::AbstractArray, value, I...)
5244end
5345
5446# TODO : Combine these by using `Base.to_indices`.
55- @interface :: AbstractAllocatableArrayInterface function Base. setindex! (
56- a:: AbstractArray , value, I:: Int...
57- )
47+ function Base. setindex! (a:: AbstractITensor , value, I:: Int... )
5848 setindex_allocatable! (a, value, I... )
5949 return a
6050end
61- @interface :: AbstractAllocatableArrayInterface function Base. setindex! (
62- a:: AbstractArray , value, I:: AbstractNamedInteger...
63- )
51+ function Base. setindex! (a:: AbstractITensor , value, I:: AbstractNamedInteger... )
6452 setindex_allocatable! (a, value, I... )
6553 return a
6654end
6755
68- @derive AllocatableArrayInterface () (T = AbstractITensor,) begin
69- Base. setindex! (:: T , :: Any , :: Int... )
70- Base. setindex! (:: T , :: Any , :: AbstractNamedInteger... )
71- end
72-
7356mutable struct ITensor <: AbstractITensor
7457 parent:: AbstractArray
7558 inds
0 commit comments