Skip to content

Commit

Permalink
[SparseArraysBase] Absorb SparseArrayDOKs (#1592)
Browse files Browse the repository at this point in the history
* [SparseArraysBase] Absorb `SparseArrayDOKs`

* [NDTensors] Bump to v0.3.71
  • Loading branch information
mtfishman authored Nov 16, 2024
1 parent 9ef8ae2 commit 549e7f1
Show file tree
Hide file tree
Showing 26 changed files with 24 additions and 30 deletions.
2 changes: 1 addition & 1 deletion NDTensors/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NDTensors"
uuid = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
authors = ["Matthew Fishman <mfishman@flatironinstitute.org>"]
version = "0.3.70"
version = "0.3.71"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# TODO: Define in `SparseArraysBase`.
using ..SparseArrayDOKs: SparseArrayDOK
using ..SparseArraysBase: SparseArrayDOK

# TODO: This is inefficient, need to optimize.
# Look at `contract_labels`, `contract_blocks` and `maybe_contract_blocks!` in:
Expand Down
1 change: 0 additions & 1 deletion NDTensors/src/imports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ for lib in [
:TensorAlgebra,
:NestedPermutedDimsArrays,
:SparseArraysBase,
:SparseArrayDOKs,
:DiagonalArrays,
:BlockSparseArrays,
:NamedDimsArrays,
Expand Down
2 changes: 1 addition & 1 deletion NDTensors/src/lib/AllocateData/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using NDTensors.AllocateData: AllocateData, allocate, allocate_zeros, zero_init
using LinearAlgebra: Diagonal, Hermitian
using NDTensors.DiagonalArrays: DiagonalArray
using NDTensors.BlockSparseArrays: BlockSparseArray
using NDTensors.SparseArrayDOKs: SparseArrayDOK
using NDTensors.SparseArraysBase: SparseArrayDOK
using Test: @test, @testset, @test_broken, @test_throws

const arraytypes = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ function view!(a::AbstractArray{<:Any,N}, index::Vararg{BlockIndexRange{1},N}) w
end

using MacroTools: @capture
using NDTensors.SparseArrayDOKs: is_getindex_expr
using NDTensors.SparseArraysBase: is_getindex_expr
macro view!(expr)
if !is_getindex_expr(expr)
error("@view must be used with getindex syntax (as `@view! a[i,j,...]`)")
Expand Down
2 changes: 1 addition & 1 deletion NDTensors/src/lib/BlockSparseArrays/src/backup/qr.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ...SparseArrayDOKs: SparseArrayDOK
using ...SparseArraysBase: SparseArrayDOK

# Check if the matrix has 1 or fewer entries
# per row/column.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using BlockArrays: BlockArrays, Block, BlockedUnitRange, blockedrange, blocklength
using Dictionaries: Dictionary
using ..SparseArrayDOKs: SparseArrayDOK
using ..SparseArraysBase: SparseArrayDOK

# TODO: Delete this.
## using BlockArrays: blocks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using BlockArrays: Block
using Dictionaries: Dictionary
using ..SparseArrayDOKs: SparseArrayDOK
using ..SparseArraysBase: SparseArrayDOK

# Construct the sparse structure storing the blocks
function default_blockdata(
Expand Down
2 changes: 1 addition & 1 deletion NDTensors/src/lib/BlockSparseArrays/test/test_basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using NDTensors.BlockSparseArrays:
view!
using NDTensors.GPUArraysCoreExtensions: cpu
using NDTensors.SparseArraysBase: stored_length
using NDTensors.SparseArrayDOKs: SparseArrayDOK, SparseMatrixDOK, SparseVectorDOK
using NDTensors.SparseArraysBase: SparseArrayDOK, SparseMatrixDOK, SparseVectorDOK
using NDTensors.TensorAlgebra: contract
using Test: @test, @test_broken, @test_throws, @testset, @inferred
include("TestBlockSparseArraysUtils.jl")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ..SparseArraysBase: Zero, getindex_zero_function
# TODO: Put into `DiagonalArraysSparseArrayDOKsExt`?
using ..SparseArrayDOKs: SparseArrayDOKs, SparseArrayDOK
# TODO: Put into `DiagonalArraysSparseArraysBaseExt`?
using ..SparseArraysBase: SparseArraysBase, SparseArrayDOK

struct DiagonalArray{T,N,Diag<:AbstractVector{T},Zero} <: AbstractDiagonalArray{T,N}
diag::Diag
Expand Down Expand Up @@ -94,7 +94,7 @@ SparseArraysBase.sparse_storage(a::DiagonalArray) = a.diag
# `SparseArraysBase`
# Defines similar when the output can't be `DiagonalArray`,
# such as in `reshape`.
# TODO: Put into `DiagonalArraysSparseArrayDOKsExt`?
# TODO: Put into `DiagonalArraysSparseArraysBaseExt`?
# TODO: Special case 2D to output `SparseMatrixCSC`?
function SparseArraysBase.sparse_similar(
a::DiagonalArray, elt::Type, dims::Tuple{Vararg{Int}}
Expand Down
2 changes: 1 addition & 1 deletion NDTensors/src/lib/DiagonalArrays/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@eval module $(gensym())
using Test: @test, @testset, @test_broken
using NDTensors.DiagonalArrays: DiagonalArrays, DiagonalArray, DiagonalMatrix, diaglength
using NDTensors.SparseArrayDOKs: SparseArrayDOK
using NDTensors.SparseArraysBase: SparseArrayDOK
using NDTensors.SparseArraysBase: stored_length
@testset "Test NDTensors.DiagonalArrays" begin
@testset "README" begin
Expand Down
2 changes: 0 additions & 2 deletions NDTensors/src/lib/SparseArrayDOKs/.JuliaFormatter.toml

This file was deleted.

7 changes: 0 additions & 7 deletions NDTensors/src/lib/SparseArrayDOKs/src/SparseArrayDOKs.jl

This file was deleted.

3 changes: 0 additions & 3 deletions NDTensors/src/lib/SparseArrayDOKs/test/Project.toml

This file was deleted.

5 changes: 5 additions & 0 deletions NDTensors/src/lib/SparseArraysBase/src/SparseArraysBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ include("abstractsparsearray/convert.jl")
include("abstractsparsearray/cat.jl")
include("abstractsparsearray/SparseArraysBaseSparseArraysExt.jl")
include("abstractsparsearray/SparseArraysBaseLinearAlgebraExt.jl")
include("sparsearraydok/defaults.jl")
include("sparsearraydok/sparsearraydok.jl")
include("sparsearraydok/sparsematrixdok.jl")
include("sparsearraydok/sparsevectordok.jl")
include("sparsearraydok/arraylayouts.jl")
end
1 change: 1 addition & 0 deletions NDTensors/src/lib/SparseArraysBase/test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
NDTensors = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2 changes: 1 addition & 1 deletion NDTensors/src/lib/SparseArraysBase/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@eval module $(gensym())
for filename in ["abstractsparsearray", "array", "diagonalarray"]
for filename in ["sparsearraydok", "abstractsparsearray", "array", "diagonalarray"]
include("test_$filename.jl")
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

using Dictionaries: Dictionary
using Test: @test, @testset, @test_broken
using NDTensors.SparseArrayDOKs:
SparseArrayDOKs, SparseArrayDOK, SparseMatrixDOK, @maybe_grow
using NDTensors.SparseArraysBase:
SparseArraysBase, SparseArrayDOK, SparseMatrixDOK, @maybe_grow
using NDTensors.SparseArraysBase: storage_indices, stored_length
using SparseArrays: SparseMatrixCSC, nnz
@testset "SparseArrayDOK (eltype=$elt)" for elt in
Expand Down Expand Up @@ -98,7 +98,7 @@ using SparseArrays: SparseMatrixCSC, nnz
end
@testset "Maybe Grow Feature" begin
a = SparseArrayDOK{elt,2}((0, 0))
SparseArrayDOKs.setindex_maybe_grow!(a, 230, 2, 3)
SparseArraysBase.setindex_maybe_grow!(a, 230, 2, 3)
@test size(a) == (2, 3)
@test a[2, 3] == 230
# Test @maybe_grow macro
Expand Down
1 change: 1 addition & 0 deletions NDTensors/test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Expand Down
2 changes: 1 addition & 1 deletion NDTensors/test/lib/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using Test: @testset
"NestedPermutedDimsArrays",
"SmallVectors",
"SortedSets",
"SparseArrayDOKs",
"SparseArraysBase",
"SymmetrySectors",
"TagSets",
"TensorAlgebra",
Expand Down

2 comments on commit 549e7f1

@mtfishman
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register subdir=NDTensors

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/119577

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a NDTensors-v0.3.71 -m "<description of version>" 549e7f16547a933fd6f4305f7ea8747da22fac03
git push origin NDTensors-v0.3.71

Please sign in to comment.