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
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BlockSparseArrays"
uuid = "2c9a651f-6452-4ace-a6ac-809f4280fbb4"
authors = ["ITensor developers <support@itensor.org> and contributors"]
version = "0.7.4"
version = "0.7.5"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down Expand Up @@ -31,7 +31,7 @@ Adapt = "4.1.1"
Aqua = "0.8.9"
ArrayLayouts = "1.10.4"
BlockArrays = "1.2.0"
DerivableInterfaces = "0.4"
DerivableInterfaces = "0.5"
DiagonalArrays = "0.3"
Dictionaries = "0.4.3"
FillArrays = "1.13.0"
Expand Down
17 changes: 10 additions & 7 deletions src/blocksparsearrayinterface/blocksparsearrayinterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,21 @@ blockstype(a::BlockArray) = blockstype(typeof(a))
blocktype(arraytype::Type{<:BlockArray}) = eltype(blockstype(arraytype))
blocktype(a::BlockArray) = eltype(blocks(a))

abstract type AbstractBlockSparseArrayInterface <: AbstractSparseArrayInterface end
abstract type AbstractBlockSparseArrayInterface{N} <: AbstractSparseArrayInterface{N} end

# TODO: Also support specifying the `blocktype` along with the `eltype`.
function DerivableInterfaces.arraytype(::AbstractBlockSparseArrayInterface, T::Type)
return BlockSparseArray{T}
function Base.similar(::AbstractBlockSparseArrayInterface, T::Type, ax::Tuple)
return similar(BlockSparseArray{T}, ax)
end

struct BlockSparseArrayInterface <: AbstractBlockSparseArrayInterface end
struct BlockSparseArrayInterface{N} <: AbstractBlockSparseArrayInterface{N} end
BlockSparseArrayInterface(::Val{N}) where {N} = BlockSparseArrayInterface{N}()
BlockSparseArrayInterface{M}(::Val{N}) where {M,N} = BlockSparseArrayInterface{N}()
BlockSparseArrayInterface() = BlockSparseArrayInterface{Any}()

@interface ::AbstractBlockSparseArrayInterface BlockArrays.blocks(a::AbstractArray) = error(
"Not implemented"
)
@interface ::AbstractBlockSparseArrayInterface function BlockArrays.blocks(a::AbstractArray)
return error("Not implemented")
end

@interface ::AbstractBlockSparseArrayInterface function SparseArraysBase.isstored(
a::AbstractArray{<:Any,N}, I::Vararg{Int,N}
Expand Down
Loading