Skip to content

Commit 82b050f

Browse files
authored
[SparseArraysBase] Rename SparseArrayInterface to SparseArraysBase (#1591)
1 parent 88eca40 commit 82b050f

File tree

13 files changed

+35
-36
lines changed

13 files changed

+35
-36
lines changed

ext/BlockSparseArraysGradedAxesExt/test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ using NDTensors.GradedAxes:
1313
gradedrange,
1414
isdual
1515
using NDTensors.LabelledNumbers: label
16-
using NDTensors.SparseArrayInterface: stored_length
16+
using NDTensors.SparseArraysBase: stored_length
1717
using NDTensors.SymmetrySectors: U1
1818
using NDTensors.TensorAlgebra: fusedims, splitdims
1919
using LinearAlgebra: adjoint

ext/BlockSparseArraysTensorAlgebraExt/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
33
using NDTensors.BlockSparseArrays: BlockSparseArray
44
using NDTensors.TensorAlgebra: contract
5-
using NDTensors.SparseArrayInterface: densearray
5+
using NDTensors.SparseArraysBase: densearray
66
@testset "BlockSparseArraysTensorAlgebraExt (eltype=$elt)" for elt in (
77
Float32, Float64, Complex{Float32}, Complex{Float64}
88
)

src/BlockArraysExtensions/BlockArraysExtensions.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using BlockArrays:
2222
using Compat: allequal
2323
using Dictionaries: Dictionary, Indices
2424
using ..GradedAxes: blockedunitrange_getindices, to_blockindices
25-
using ..SparseArrayInterface: SparseArrayInterface, stored_length, stored_indices
25+
using ..SparseArraysBase: SparseArraysBase, stored_length, stored_indices
2626

2727
# A return type for `blocks(array)` when `array` isn't blocked.
2828
# Represents a vector with just that single block.
@@ -534,7 +534,7 @@ function Base.setindex!(a::BlockView{<:Any,N}, value, index::Vararg{Int,N}) wher
534534
return a
535535
end
536536

537-
function SparseArrayInterface.stored_length(a::BlockView)
537+
function SparseArraysBase.stored_length(a::BlockView)
538538
# TODO: Store whether or not the block is stored already as
539539
# a Bool in `BlockView`.
540540
I = CartesianIndex(Int.(a.block))
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
using BlockArrays: AbstractBlockArray, BlocksView
2-
using ..SparseArrayInterface: SparseArrayInterface, stored_length
2+
using ..SparseArraysBase: SparseArraysBase, stored_length
33

4-
function SparseArrayInterface.stored_length(a::AbstractBlockArray)
4+
function SparseArraysBase.stored_length(a::AbstractBlockArray)
55
return sum(b -> stored_length(b), blocks(a); init=zero(Int))
66
end
77

88
# TODO: Handle `BlocksView` wrapping a sparse array?
9-
function SparseArrayInterface.storage_indices(a::BlocksView)
9+
function SparseArraysBase.storage_indices(a::BlocksView)
1010
return CartesianIndices(a)
1111
end

src/BlockSparseArrays.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ include("abstractblocksparsearray/linearalgebra.jl")
2121
include("abstractblocksparsearray/cat.jl")
2222
include("blocksparsearray/defaults.jl")
2323
include("blocksparsearray/blocksparsearray.jl")
24-
include("BlockArraysSparseArrayInterfaceExt/BlockArraysSparseArrayInterfaceExt.jl")
24+
include("BlockArraysSparseArraysBaseExt/BlockArraysSparseArraysBaseExt.jl")
2525
include("../ext/BlockSparseArraysTensorAlgebraExt/src/BlockSparseArraysTensorAlgebraExt.jl")
2626
include("../ext/BlockSparseArraysGradedAxesExt/src/BlockSparseArraysGradedAxesExt.jl")
2727
include("../ext/BlockSparseArraysAdaptExt/src/BlockSparseArraysAdaptExt.jl")

src/abstractblocksparsearray/abstractblocksparsearray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using BlockArrays:
22
BlockArrays, AbstractBlockArray, Block, BlockIndex, BlockedUnitRange, blocks
3-
using ..SparseArrayInterface: sparse_getindex, sparse_setindex!
3+
using ..SparseArraysBase: sparse_getindex, sparse_setindex!
44

55
# TODO: Delete this. This function was replaced
66
# by `stored_length` but is still used in `NDTensors`.

src/abstractblocksparsearray/arraylayouts.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ArrayLayouts: ArrayLayouts, DualLayout, MemoryLayout, MulAdd
22
using BlockArrays: BlockLayout
3-
using ..SparseArrayInterface: SparseLayout
3+
using ..SparseArraysBase: SparseLayout
44
using ..TypeParameterAccessors: parenttype, similartype
55

66
function ArrayLayouts.MemoryLayout(arraytype::Type{<:AnyAbstractBlockSparseArray})

src/abstractblocksparsearray/map.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using ArrayLayouts: LayoutArray
22
using BlockArrays: blockisequal
33
using LinearAlgebra: Adjoint, Transpose
4-
using ..SparseArrayInterface:
5-
SparseArrayInterface,
4+
using ..SparseArraysBase:
5+
SparseArraysBase,
66
SparseArrayStyle,
77
sparse_map!,
88
sparse_copy!,
@@ -62,7 +62,7 @@ end
6262
# is used to determine `union_stored_blocked_cartesianindices(...)`).
6363
# `reblock` is a partial solution to that, but a bit ad-hoc.
6464
# TODO: Move to `blocksparsearrayinterface/map.jl`.
65-
function SparseArrayInterface.sparse_map!(
65+
function SparseArraysBase.sparse_map!(
6666
::BlockSparseArrayStyle, f, a_dest::AbstractArray, a_srcs::Vararg{AbstractArray}
6767
)
6868
a_dest, a_srcs = reblock(a_dest), reblock.(a_srcs)
@@ -89,7 +89,7 @@ function SparseArrayInterface.sparse_map!(
8989
end
9090

9191
# TODO: Implement this.
92-
# function SparseArrayInterface.sparse_mapreduce(::BlockSparseArrayStyle, f, a_dest::AbstractArray, a_srcs::Vararg{AbstractArray})
92+
# function SparseArraysBase.sparse_mapreduce(::BlockSparseArrayStyle, f, a_dest::AbstractArray, a_srcs::Vararg{AbstractArray})
9393
# end
9494

9595
function Base.map!(f, a_dest::AbstractArray, a_srcs::Vararg{AnyAbstractBlockSparseArray})

src/abstractblocksparsearray/sparsearrayinterface.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using BlockArrays: Block
2-
using ..SparseArrayInterface: SparseArrayInterface, sparse_storage, stored_indices
2+
using ..SparseArraysBase: SparseArraysBase, sparse_storage, stored_indices
33

44
# Structure storing the block sparse storage
55
struct BlockSparseStorage{Arr<:AbstractBlockSparseArray}
@@ -29,10 +29,10 @@ function Base.iterate(s::BlockSparseStorage, args...)
2929
return iterate(values(s), args...)
3030
end
3131

32-
function SparseArrayInterface.sparse_storage(a::AbstractBlockSparseArray)
32+
function SparseArraysBase.sparse_storage(a::AbstractBlockSparseArray)
3333
return BlockSparseStorage(a)
3434
end
3535

36-
function SparseArrayInterface.stored_length(a::AnyAbstractBlockSparseArray)
36+
function SparseArraysBase.stored_length(a::AnyAbstractBlockSparseArray)
3737
return sum(stored_length, sparse_storage(blocks(a)); init=zero(Int))
3838
end

src/blocksparsearrayinterface/arraylayouts.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ArrayLayouts: ArrayLayouts, Dot, MatMulMatAdd, MatMulVecAdd, MulAdd
22
using BlockArrays: BlockLayout
3-
using ..SparseArrayInterface: SparseLayout
3+
using ..SparseArraysBase: SparseLayout
44
using LinearAlgebra: dot, mul!
55

66
function blocksparse_muladd!(

0 commit comments

Comments
 (0)