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
1 change: 1 addition & 0 deletions .github/workflows/IntegrationTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
paths:
- 'Project.toml'
pull_request:
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft]
paths:
- 'Project.toml'

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
paths-ignore:
- 'docs/**'
pull_request:
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft]
workflow_dispatch:

concurrency:
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "SparseArraysBase"
uuid = "0d5efcca-f356-4864-8770-e1ed8d78f208"
version = "0.9.2"
version = "0.9.3"
authors = ["ITensor developers <support@itensor.org> and contributors"]

[workspace]
Expand Down
17 changes: 3 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,9 @@ julia> Pkg.add("SparseArraysBase")
## Examples

````julia
using SparseArraysBase:
SparseArrayDOK,
SparseMatrixDOK,
SparseVectorDOK,
eachstoredindex,
getstoredindex,
getunstoredindex,
isstored,
setstoredindex!,
setunstoredindex!,
storedlength,
storedpairs,
storedvalues,
zero!
using SparseArraysBase: SparseArrayDOK, SparseMatrixDOK, SparseVectorDOK, eachstoredindex,
getstoredindex, getunstoredindex, isstored, setstoredindex!, setunstoredindex!,
storedlength, storedpairs, storedvalues, zero!
using Test: @test, @test_throws

a = SparseArrayDOK{Float64}(undef, 2, 2)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using SparseArraysBase
using BenchmarkTools
using SparseArraysBase

SUITE = BenchmarkGroup()
SUITE["rand"] = @benchmarkable rand(10)
Expand Down
6 changes: 3 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using SparseArraysBase: SparseArraysBase
using Documenter: Documenter, DocMeta, deploydocs, makedocs
using SparseArraysBase: SparseArraysBase

DocMeta.setdocmeta!(
SparseArraysBase, :DocTestSetup, :(using SparseArraysBase); recursive = true
SparseArraysBase, :DocTestSetup, :(using SparseArraysBase); recursive = true,
)

include("make_index.jl")
Expand All @@ -20,5 +20,5 @@ makedocs(;
)

deploydocs(;
repo = "github.com/ITensor/SparseArraysBase.jl", devbranch = "main", push_preview = true
repo = "github.com/ITensor/SparseArraysBase.jl", devbranch = "main", push_preview = true,
)
17 changes: 3 additions & 14 deletions examples/README.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,9 @@ julia> Pkg.add("SparseArraysBase")

# ## Examples

using SparseArraysBase:
SparseArrayDOK,
SparseMatrixDOK,
SparseVectorDOK,
eachstoredindex,
getstoredindex,
getunstoredindex,
isstored,
setstoredindex!,
setunstoredindex!,
storedlength,
storedpairs,
storedvalues,
zero!
using SparseArraysBase: SparseArrayDOK, SparseMatrixDOK, SparseVectorDOK, eachstoredindex,
getstoredindex, getunstoredindex, isstored, setstoredindex!, setunstoredindex!,
storedlength, storedpairs, storedvalues, zero!
using Test: @test, @test_throws

a = SparseArrayDOK{Float64}(undef, 2, 2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module SparseArraysBaseNamedDimsArraysExt

using NamedDimsArrays: AbstractNamedDimsArray, AbstractNamedUnitRange, denamed, inds,
name, nameddims, nameddimsof
using NamedDimsArrays: AbstractNamedDimsArray, AbstractNamedUnitRange, denamed, inds, name,
nameddims, nameddimsof
using SparseArraysBase: SparseArraysBase, dense, oneelement

function SparseArraysBase.dense(a::AbstractNamedDimsArray)
Expand All @@ -11,7 +11,7 @@ function SparseArraysBase.dense(a::AbstractNamedDimsArray)
end

function SparseArraysBase.oneelement(
value, index::NTuple{N, Int}, ax::NTuple{N, AbstractNamedUnitRange}
value, index::NTuple{N, Int}, ax::NTuple{N, AbstractNamedUnitRange},
) where {N}
return nameddims(oneelement(value, index, denamed.(ax)), name.(ax))
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct SparseArrayFusion <: FusionStyle end
TensorAlgebra.FusionStyle(::Type{<:AnyAbstractSparseArray}) = SparseArrayFusion()

function TensorAlgebra.matricize(
style::SparseArrayFusion, a::AbstractArray, length_codomain::Val
style::SparseArrayFusion, a::AbstractArray, length_codomain::Val,
)
m = matricize(ReshapeFusion(), a, length_codomain)
return convert(SparseMatrixCSC, m)
Expand Down
19 changes: 12 additions & 7 deletions src/abstractsparsearray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ const AnyAbstractSparseVecOrMat{T} = Union{
Base.convert(T::Type{<:AbstractSparseArray}, a::AbstractArray) = a isa T ? a : T(a)

using FunctionImplementations: FunctionImplementations
FunctionImplementations.ImplementationStyle(::Type{<:AnyAbstractSparseArray}) =
SparseArrayImplementationStyle()
function FunctionImplementations.ImplementationStyle(::Type{<:AnyAbstractSparseArray})
return SparseArrayImplementationStyle()
end

function Base.copy(a::AnyAbstractSparseArray)
return copyto!(similar(a), a)
Expand All @@ -51,7 +52,7 @@ function Base.similar(a::AnyAbstractSparseArray, T::Type, ax::Tuple{Vararg{Int}}
return similar_sparsearray(a, T, ax)
end
function Base.similar(
a::AnyAbstractSparseArray, T::Type, ax::Tuple{Integer, Vararg{Integer}}
a::AnyAbstractSparseArray, T::Type, ax::Tuple{Integer, Vararg{Integer}},
)
return similar_sparsearray(a, T, ax)
end
Expand Down Expand Up @@ -145,7 +146,7 @@ function Base.print_array(io::IO, a::AnyAbstractSparseArray)
return @invoke Base.print_array(io::typeof(io), a′::AbstractArray{<:Any, ndims(a)})
end
function Base.replace_in_print_matrix(
a::AnyAbstractSparseVecOrMat, i::Integer, j::Integer, s::AbstractString
a::AnyAbstractSparseVecOrMat, i::Integer, j::Integer, s::AbstractString,
)
return isstored(a, i, j) ? s : Base.replace_with_centered_mark(s)
end
Expand Down Expand Up @@ -261,7 +262,7 @@ See also [`sparserand`](@ref).

sparserand!(A::AbstractArray; kwargs...) = sparserand!(default_rng(), A; kwargs...)
function sparserand!(
rng::AbstractRNG, A::AbstractArray; density::Real = 0.5, randfun::Function = Random.rand
rng::AbstractRNG, A::AbstractArray; density::Real = 0.5, randfun::Function = Random.rand,
)
ArrayLayouts.zero!(A)
rand_inds = Random.randsubseq(rng, eachindex(A), density)
Expand All @@ -273,10 +274,14 @@ end

using ArrayLayouts: ArrayLayouts, MemoryLayout
using LinearAlgebra: LinearAlgebra, Adjoint
function ArrayLayouts.MemoryLayout(::Type{Transpose{T, P}}) where {T, P <: AbstractSparseMatrix}
function ArrayLayouts.MemoryLayout(
::Type{Transpose{T, P}},
) where {T, P <: AbstractSparseMatrix}
return MemoryLayout(P)
end
function ArrayLayouts.MemoryLayout(::Type{Adjoint{T, P}}) where {T, P <: AbstractSparseMatrix}
function ArrayLayouts.MemoryLayout(
::Type{Adjoint{T, P}},
) where {T, P <: AbstractSparseMatrix}
return MemoryLayout(P)
end
function LinearAlgebra.mul!(
Expand Down
4 changes: 2 additions & 2 deletions src/abstractsparsearraystyle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function mul!!(
end

function mul!!(
a_dest::Number, a1::Number, a2::Number, α::Number = true, β::Number = false
a_dest::Number, a1::Number, a2::Number, α::Number = true, β::Number = false,
)
return a1 * a2 * α + a_dest * β
end
Expand Down Expand Up @@ -165,7 +165,7 @@ function _mul!_sparse(
end

function ArrayLayouts.materialize!(
m::MatMulMatAdd{<:AbstractSparseLayout, <:AbstractSparseLayout, <:AbstractSparseLayout}
m::MatMulMatAdd{<:AbstractSparseLayout, <:AbstractSparseLayout, <:AbstractSparseLayout},
)
_mul!_sparse(m.C, m.A, m.B, m.α, m.β)
return m.C
Expand Down
Loading
Loading