Skip to content

Commit 062b498

Browse files
authored
[SparseArraysBase] Rename SparseArrayInterface to SparseArraysBase (#1591)
1 parent f0570d1 commit 062b498

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
using ..SparseArrayInterface: AbstractSparseArray
1+
using ..SparseArraysBase: AbstractSparseArray
22

33
abstract type AbstractDiagonalArray{T,N} <: AbstractSparseArray{T,N} end

src/abstractdiagonalarray/arraylayouts.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using ArrayLayouts: ArrayLayouts
2-
using ..SparseArrayInterface: AbstractSparseLayout
2+
using ..SparseArraysBase: AbstractSparseLayout
33

44
abstract type AbstractDiagonalLayout <: AbstractSparseLayout end
55
struct DiagonalLayout <: AbstractDiagonalLayout end

src/abstractdiagonalarray/diagonalarraydiaginterface.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using ..SparseArrayInterface: SparseArrayInterface, StorageIndex, StorageIndices
1+
using ..SparseArraysBase: SparseArraysBase, StorageIndex, StorageIndices
22

3-
SparseArrayInterface.StorageIndex(i::DiagIndex) = StorageIndex(index(i))
3+
SparseArraysBase.StorageIndex(i::DiagIndex) = StorageIndex(index(i))
44

55
function Base.getindex(a::AbstractDiagonalArray, i::DiagIndex)
66
return a[StorageIndex(i)]
@@ -11,7 +11,7 @@ function Base.setindex!(a::AbstractDiagonalArray, value, i::DiagIndex)
1111
return a
1212
end
1313

14-
SparseArrayInterface.StorageIndices(i::DiagIndices) = StorageIndices(indices(i))
14+
SparseArraysBase.StorageIndices(i::DiagIndices) = StorageIndices(indices(i))
1515

1616
function Base.getindex(a::AbstractDiagonalArray, i::DiagIndices)
1717
return a[StorageIndices(i)]

src/abstractdiagonalarray/sparsearrayinterface.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
using Compat: Returns, allequal
2-
using ..SparseArrayInterface: SparseArrayInterface
2+
using ..SparseArraysBase: SparseArraysBase
33

4-
# `SparseArrayInterface` interface
5-
function SparseArrayInterface.index_to_storage_index(
4+
# `SparseArraysBase` interface
5+
function SparseArraysBase.index_to_storage_index(
66
a::AbstractDiagonalArray{<:Any,N}, I::CartesianIndex{N}
77
) where {N}
88
!allequal(Tuple(I)) && return nothing
99
return first(Tuple(I))
1010
end
1111

12-
function SparseArrayInterface.storage_index_to_index(a::AbstractDiagonalArray, I)
12+
function SparseArraysBase.storage_index_to_index(a::AbstractDiagonalArray, I)
1313
return CartesianIndex(ntuple(Returns(I), ndims(a)))
1414
end
1515

1616
## # 1-dimensional case can be `AbstractDiagonalArray`.
17-
## function SparseArrayInterface.sparse_similar(
17+
## function SparseArraysBase.sparse_similar(
1818
## a::AbstractDiagonalArray, elt::Type, dims::Tuple{Int}
1919
## )
2020
## # TODO: Handle preserving zero element function.

src/diagonalarray/diagonalarray.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using ..SparseArrayInterface: Zero, getindex_zero_function
1+
using ..SparseArraysBase: Zero, getindex_zero_function
22
# TODO: Put into `DiagonalArraysSparseArrayDOKsExt`?
33
using ..SparseArrayDOKs: SparseArrayDOKs, SparseArrayDOK
44

@@ -88,20 +88,20 @@ function Base.similar(a::DiagonalArray, elt::Type, dims::Tuple{Vararg{Int}})
8888
return DiagonalArray{elt}(undef, dims, getindex_zero_function(a))
8989
end
9090

91-
# Minimal `SparseArrayInterface` interface
92-
SparseArrayInterface.sparse_storage(a::DiagonalArray) = a.diag
91+
# Minimal `SparseArraysBase` interface
92+
SparseArraysBase.sparse_storage(a::DiagonalArray) = a.diag
9393

94-
# `SparseArrayInterface`
94+
# `SparseArraysBase`
9595
# Defines similar when the output can't be `DiagonalArray`,
9696
# such as in `reshape`.
9797
# TODO: Put into `DiagonalArraysSparseArrayDOKsExt`?
9898
# TODO: Special case 2D to output `SparseMatrixCSC`?
99-
function SparseArrayInterface.sparse_similar(
99+
function SparseArraysBase.sparse_similar(
100100
a::DiagonalArray, elt::Type, dims::Tuple{Vararg{Int}}
101101
)
102102
return SparseArrayDOK{elt}(undef, dims, getindex_zero_function(a))
103103
end
104104

105-
function SparseArrayInterface.getindex_zero_function(a::DiagonalArray)
105+
function SparseArraysBase.getindex_zero_function(a::DiagonalArray)
106106
return a.zero
107107
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using Test: @test, @testset, @test_broken
33
using NDTensors.DiagonalArrays: DiagonalArrays, DiagonalArray, DiagonalMatrix, diaglength
44
using NDTensors.SparseArrayDOKs: SparseArrayDOK
5-
using NDTensors.SparseArrayInterface: stored_length
5+
using NDTensors.SparseArraysBase: stored_length
66
@testset "Test NDTensors.DiagonalArrays" begin
77
@testset "README" begin
88
@test include(

0 commit comments

Comments
 (0)