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
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name = "SparseArraysBase"
uuid = "0d5efcca-f356-4864-8770-e1ed8d78f208"
authors = ["ITensor developers <[email protected]> and contributors"]
version = "0.2.2"
version = "0.2.3"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
BroadcastMapConversion = "4a4adec5-520f-4750-bb37-d5e66b4ddeb2"
Derive = "a07dfc7f-7d04-4eb5-84cc-a97f051f655a"
DerivableInterfaces = "6c5e35bf-e59e-4898-b73c-732dcc4ba65f"
Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MapBroadcast = "ebd9b9da-f48d-417c-9660-449667d60261"

[compat]
Aqua = "0.8.9"
ArrayLayouts = "1.11.0"
BroadcastMapConversion = "0.1.0"
Derive = "0.3.6"
DerivableInterfaces = "0.3.7"
Dictionaries = "0.4.3"
LinearAlgebra = "1.10"
MapBroadcast = "0.1.5"
SafeTestsets = "0.1"
Suppressor = "0.2"
Test = "1.10"
Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Updates for latest Derive.
- Updates for latest DerivableInterfaces.
10 changes: 5 additions & 5 deletions src/abstractsparsearray.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
abstract type AbstractSparseArray{T,N} <: AbstractArray{T,N} end

using Derive: @array_aliases
using DerivableInterfaces: @array_aliases
# Define AbstractSparseVector, AnyAbstractSparseArray, etc.
@array_aliases AbstractSparseArray

using Derive: Derive
function Derive.interface(::Type{<:AbstractSparseArray})
using DerivableInterfaces: DerivableInterfaces
function DerivableInterfaces.interface(::Type{<:AbstractSparseArray})
return SparseArrayInterface()
end

using Derive: @derive
using DerivableInterfaces: @derive

# TODO: These need to be loaded since `AbstractArrayOps`
# includes overloads of functions from these modules.
Expand All @@ -18,7 +18,7 @@ using Derive: @derive
using ArrayLayouts: ArrayLayouts
using LinearAlgebra: LinearAlgebra

# Derive `Base.getindex`, `Base.setindex!`, etc.
# DerivableInterfaces `Base.getindex`, `Base.setindex!`, etc.
# TODO: Define `AbstractMatrixOps` and overload for
# `AnyAbstractSparseMatrix` and `AnyAbstractSparseVector`,
# which is where matrix multiplication and factorizations
Expand Down
12 changes: 6 additions & 6 deletions src/abstractsparsearrayinterface.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Derive: Derive, @derive, @interface, AbstractArrayInterface
using DerivableInterfaces: DerivableInterfaces, @derive, @interface, AbstractArrayInterface

# This is to bring `ArrayLayouts.zero!` into the namespace
# since it is considered part of the sparse array interface.
Expand Down Expand Up @@ -71,7 +71,7 @@
@interface ::AbstractArrayInterface getunstoredindex(a::AbstractArray, I::Int...) =
zero(eltype(a))

# Derived interface.
# DerivableInterfacesd interface.
@interface ::AbstractArrayInterface storedlength(a::AbstractArray) = length(storedvalues(a))
@interface ::AbstractArrayInterface storedpairs(a::AbstractArray) =
map(I -> I => getstoredindex(a, I), eachstoredindex(a))
Expand Down Expand Up @@ -104,22 +104,22 @@
# type instead so fallback functions can use abstract types.
abstract type AbstractSparseArrayInterface <: AbstractArrayInterface end

function Derive.combine_interface_rule(
function DerivableInterfaces.combine_interface_rule(

Check warning on line 107 in src/abstractsparsearrayinterface.jl

View check run for this annotation

Codecov / codecov/patch

src/abstractsparsearrayinterface.jl#L107

Added line #L107 was not covered by tests
interface1::AbstractSparseArrayInterface, interface2::AbstractSparseArrayInterface
)
return error("Rule not defined.")
end
function Derive.combine_interface_rule(
function DerivableInterfaces.combine_interface_rule(

Check warning on line 112 in src/abstractsparsearrayinterface.jl

View check run for this annotation

Codecov / codecov/patch

src/abstractsparsearrayinterface.jl#L112

Added line #L112 was not covered by tests
interface1::Interface, interface2::Interface
) where {Interface<:AbstractSparseArrayInterface}
return interface1
end
function Derive.combine_interface_rule(
function DerivableInterfaces.combine_interface_rule(

Check warning on line 117 in src/abstractsparsearrayinterface.jl

View check run for this annotation

Codecov / codecov/patch

src/abstractsparsearrayinterface.jl#L117

Added line #L117 was not covered by tests
interface1::AbstractSparseArrayInterface, interface2::AbstractArrayInterface
)
return interface1
end
function Derive.combine_interface_rule(
function DerivableInterfaces.combine_interface_rule(

Check warning on line 122 in src/abstractsparsearrayinterface.jl

View check run for this annotation

Codecov / codecov/patch

src/abstractsparsearrayinterface.jl#L122

Added line #L122 was not covered by tests
interface1::AbstractArrayInterface, interface2::AbstractSparseArrayInterface
)
return interface2
Expand Down
8 changes: 4 additions & 4 deletions src/sparsearraydok.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ struct SparseArrayDOK{T,N,F} <: AbstractSparseArray{T,N}
getunstoredindex::F
end

using Derive: Derive
# This defines the destination type of various operations in Derive.jl.
Derive.arraytype(::AbstractSparseArrayInterface, T::Type) = SparseArrayDOK{T}
using DerivableInterfaces: DerivableInterfaces
# This defines the destination type of various operations in DerivableInterfaces.jl.
DerivableInterfaces.arraytype(::AbstractSparseArrayInterface, T::Type) = SparseArrayDOK{T}

function SparseArrayDOK{T,N}(size::Vararg{Int,N}) where {T,N}
getunstoredindex = default_getunstoredindex
Expand All @@ -28,7 +28,7 @@ function SparseArrayDOK{T}(size::Int...) where {T}
return SparseArrayDOK{T,length(size)}(size...)
end

using Derive: @array_aliases
using DerivableInterfaces: @array_aliases
# Define `SparseMatrixDOK`, `AnySparseArrayDOK`, etc.
@array_aliases SparseArrayDOK

Expand Down
12 changes: 7 additions & 5 deletions src/sparsearrayinterface.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
using Derive: Derive
using DerivableInterfaces: DerivableInterfaces

struct SparseArrayInterface <: AbstractSparseArrayInterface end

# Fix ambiguity error.
function Derive.combine_interface_rule(::SparseArrayInterface, ::SparseArrayInterface)
function DerivableInterfaces.combine_interface_rule(
::SparseArrayInterface, ::SparseArrayInterface
)
return SparseArrayInterface()
end
function Derive.combine_interface_rule(
function DerivableInterfaces.combine_interface_rule(

Check warning on line 11 in src/sparsearrayinterface.jl

View check run for this annotation

Codecov / codecov/patch

src/sparsearrayinterface.jl#L11

Added line #L11 was not covered by tests
interface1::SparseArrayInterface, interface2::AbstractSparseArrayInterface
)
return interface1
end
function Derive.combine_interface_rule(
function DerivableInterfaces.combine_interface_rule(

Check warning on line 16 in src/sparsearrayinterface.jl

View check run for this annotation

Codecov / codecov/patch

src/sparsearrayinterface.jl#L16

Added line #L16 was not covered by tests
interface1::AbstractSparseArrayInterface, interface2::SparseArrayInterface
)
return interface2
Expand All @@ -23,4 +25,4 @@
# version of `map`.
# const sparse = SparseArrayInterface()

Derive.interface(::Type{<:AbstractSparseArrayStyle}) = SparseArrayInterface()
DerivableInterfaces.interface(::Type{<:AbstractSparseArrayStyle}) = SparseArrayInterface()
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Derive = "a07dfc7f-7d04-4eb5-84cc-a97f051f655a"
DerivableInterfaces = "6c5e35bf-e59e-4898-b73c-732dcc4ba65f"
Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Expand Down
Loading