Skip to content

Commit 7771273

Browse files
authored
Merge branch 'master' into jishnub/eigen
2 parents 42f7c9d + a7ddcca commit 7771273

15 files changed

+885
-138
lines changed

.github/workflows/CompatHelper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
run: which julia
1616
continue-on-error: true
1717
- name: Install Julia, but only if it is not already available in the PATH
18-
uses: julia-actions/setup-julia@v1
18+
uses: julia-actions/setup-julia@v2
1919
with:
2020
version: '1'
2121
arch: ${{ runner.arch }}

.github/workflows/Invalidations.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Invalidations
22

33
on:
44
pull_request:
5+
paths-ignore:
6+
- 'LICENSE'
7+
- 'README.md'
8+
- '.github/workflows/TagBot.yml'
59

610
concurrency:
711
# Skip intermediate builds: always.
@@ -16,7 +20,7 @@ jobs:
1620
if: github.base_ref == github.event.repository.default_branch
1721
runs-on: ubuntu-latest
1822
steps:
19-
- uses: julia-actions/setup-julia@v1
23+
- uses: julia-actions/setup-julia@v2
2024
with:
2125
version: '1'
2226
- uses: actions/checkout@v4

.github/workflows/ci.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@ on:
33
push:
44
branches:
55
- master
6+
tags: [v*]
7+
paths-ignore:
8+
- 'LICENSE'
9+
- 'README.md'
10+
- '.github/workflows/TagBot.yml'
611
pull_request:
12+
paths-ignore:
13+
- 'LICENSE'
14+
- 'README.md'
15+
- '.github/workflows/TagBot.yml'
16+
717

818
concurrency:
919
group: build-${{ github.event.pull_request.number || github.ref }}-${{ github.workflow }}
@@ -28,9 +38,8 @@ jobs:
2838
fail-fast: false
2939
matrix:
3040
version:
31-
- '1.6'
41+
- 'lts'
3242
- '1'
33-
- '~1.10.0-0'
3443
os:
3544
- ubuntu-latest
3645
- macOS-latest
@@ -39,14 +48,15 @@ jobs:
3948
- x64
4049
steps:
4150
- uses: actions/checkout@v4
42-
- uses: julia-actions/setup-julia@v1
51+
- uses: julia-actions/setup-julia@v2.2
4352
with:
4453
version: ${{ matrix.version }}
4554
arch: ${{ matrix.arch }}
46-
- uses: julia-actions/cache@v1
55+
- uses: julia-actions/cache@v2
4756
- uses: julia-actions/julia-buildpkg@v1
4857
- uses: julia-actions/julia-runtest@v1
4958
- uses: julia-actions/julia-processcoverage@v1
50-
- uses: codecov/codecov-action@v3
59+
- uses: codecov/codecov-action@v4
5160
with:
61+
token: ${{ secrets.CODECOV_TOKEN }}
5262
file: lcov.info

.github/workflows/docs.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@ name: Documentation
22

33
on:
44
pull_request:
5+
paths-ignore:
6+
- 'LICENSE'
7+
- 'README.md'
8+
- '.github/workflows/TagBot.yml'
59
push:
610
branches:
711
- 'master'
812
- 'release-'
913
tags: '*'
14+
paths-ignore:
15+
- 'LICENSE'
16+
- 'README.md'
17+
- '.github/workflows/TagBot.yml'
1018
release:
1119
types: [published]
1220

@@ -23,7 +31,7 @@ jobs:
2331
with:
2432
version: ${{ matrix.julia-version }}
2533
- name: Cache artifacts
26-
uses: actions/cache@v3
34+
uses: actions/cache@v4
2735
env:
2836
cache-name: cache-artifacts
2937
with:

.github/workflows/downstream.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
push:
44
branches: [master]
55
tags: [v*]
6+
paths-ignore:
7+
- 'LICENSE'
8+
- 'README.md'
9+
- '.github/workflows/TagBot.yml'
610
pull_request:
711
paths-ignore:
812
- 'LICENSE'
@@ -29,24 +33,24 @@ jobs:
2933
name: ${{ matrix.package.group }}/${{ matrix.package.repo }}/${{ matrix.julia-version }}
3034
runs-on: ${{ matrix.os }}
3135
strategy:
32-
fail-fast: true
36+
fail-fast: false
3337
matrix:
3438
julia-version: ['1']
3539
os: [ubuntu-latest]
3640
package:
3741
- {repo: Distributions.jl, group: JuliaStats}
3842
- {repo: BlockArrays.jl, group: JuliaArrays}
39-
- {repo: LazyArrays.jl, group: JuliaArrays}
43+
# - {repo: LazyArrays.jl, group: JuliaArrays}
4044
- {repo: ArrayLayouts.jl, group: JuliaLinearAlgebra}
41-
- {repo: LazyBandedMatrices.jl, group: JuliaLinearAlgebra}
45+
# - {repo: LazyBandedMatrices.jl, group: JuliaLinearAlgebra}
4246
- {repo: BandedMatrices.jl, group: JuliaLinearAlgebra}
4347
- {repo: BlockBandedMatrices.jl, group: JuliaLinearAlgebra}
44-
- {repo: InfiniteLinearAlgebra.jl, group: JuliaLinearAlgebra}
48+
# - {repo: InfiniteLinearAlgebra.jl, group: JuliaLinearAlgebra}
4549
- {repo: Optim.jl, group: JuliaNLSolvers}
4650

4751
steps:
4852
- uses: actions/checkout@v4
49-
- uses: julia-actions/setup-julia@v1
53+
- uses: julia-actions/setup-julia@v2
5054
with:
5155
version: ${{ matrix.julia-version }}
5256
arch: x64
@@ -74,6 +78,7 @@ jobs:
7478
exit(0) # Exit immediately, as a success
7579
end
7680
- uses: julia-actions/julia-processcoverage@v1
77-
- uses: codecov/codecov-action@v3
81+
- uses: codecov/codecov-action@v4
7882
with:
83+
token: ${{ secrets.CODECOV_TOKEN }}
7984
files: lcov.info

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
deps/deps.jl
55
.DS_Store
66
Manifest.toml
7+
Manifest-v*.*.toml
78
docs/build

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
name = "FillArrays"
22
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
3-
version = "1.10.0"
3+
version = "1.11"
44

55
[deps]
66
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
77
PDMats = "90014a1f-27ba-587c-ab20-58faa44d9150"
8-
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
98
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
109
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1110

@@ -42,11 +41,12 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
4241
Infinities = "e1ba4f0e-776d-440f-acd9-e1d2e9742647"
4342
PDMats = "90014a1f-27ba-587c-ab20-58faa44d9150"
4443
Quaternions = "94ee1d12-ae83-5a48-8b1c-48b8ff168ae0"
44+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
4545
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
4646
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
4747
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
4848
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
4949
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5050

5151
[targets]
52-
test = ["Aqua", "Test", "Base64", "Infinities", "PDMats", "ReverseDiff", "SparseArrays", "StaticArrays", "Statistics", "Quaternions", "Documenter"]
52+
test = ["Aqua", "Test", "Base64", "Infinities", "PDMats", "ReverseDiff", "SparseArrays", "StaticArrays", "Statistics", "Quaternions", "Documenter", "Random"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![codecov](https://codecov.io/gh/JuliaArrays/FillArrays.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaArrays/FillArrays.jl)
77
[![deps](https://juliahub.com/docs/FillArrays/deps.svg)](https://juliahub.com/ui/Packages/FillArrays/2Dg1l?t=2)
88
[![version](https://juliahub.com/docs/FillArrays/version.svg)](https://juliahub.com/ui/Packages/FillArrays/2Dg1l)
9-
[![pkgeval](https://juliahub.com/docs/FillArrays/pkgeval.svg)](https://juliahub.com/ui/Packages/FillArrays/2Dg1l)
9+
[![pkgeval](https://juliahub.com/docs/FillArrays/pkgeval.svg)](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html)
1010
[![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
1111

1212
Julia package to lazily represent matrices filled with a single entry,

ext/FillArraysSparseArraysExt.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
module FillArraysSparseArraysExt
22

33
using SparseArrays
4-
import Base: convert, kron
54
using FillArrays
65
using FillArrays: RectDiagonalFill, RectOrDiagonalFill, ZerosVector, ZerosMatrix, getindex_value
7-
using LinearAlgebra
6+
import Base: convert, kron
7+
# Specifying the full namespace is necessary because of https://github.com/JuliaLang/julia/issues/48533
8+
# See https://github.com/JuliaStats/LogExpFunctions.jl/pull/63
9+
using FillArrays.LinearAlgebra
810

911
##################
1012
## Sparse arrays

src/FillArrays.jl

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Base: size, getindex, setindex!, IndexStyle, checkbounds, convert,
77
any, all, axes, isone, iszero, iterate, unique, allunique, permutedims, inv,
88
copy, vec, setindex!, count, ==, reshape, map, zero,
99
show, view, in, mapreduce, one, reverse, promote_op, promote_rule, repeat,
10-
parent, similar, issorted
10+
parent, similar, issorted, add_sum, accumulate, OneTo
1111

1212
import LinearAlgebra: rank, svdvals!, tril, triu, tril!, triu!, diag, transpose, adjoint, fill!,
1313
dot, norm2, norm1, normInf, normMinusInf, normp, lmul!, rmul!, diagzero, AdjointAbsVec, TransposeAbsVec,
@@ -24,7 +24,8 @@ import Base: oneto
2424
"""
2525
AbstractFill{T, N, Axes} <: AbstractArray{T, N}
2626
27-
Supertype for lazy array types whose entries are all equal to constant.
27+
Supertype for lazy array types whose entries are all equal.
28+
Subtypes of `AbstractFill` should implement [`FillArrays.getindex_value`](@ref) to return the value of the entries.
2829
"""
2930
abstract type AbstractFill{T, N, Axes} <: AbstractArray{T, N} end
3031
const AbstractFillVector{T} = AbstractFill{T,1}
@@ -33,6 +34,10 @@ const AbstractFillVecOrMat{T} = Union{AbstractFillVector{T},AbstractFillMatrix{T
3334

3435
==(a::AbstractFill, b::AbstractFill) = axes(a) == axes(b) && getindex_value(a) == getindex_value(b)
3536

37+
@inline function Base.isassigned(F::AbstractFill, i::Integer...)
38+
@boundscheck checkbounds(Bool, F, to_indices(F, i)...) || return false
39+
return true
40+
end
3641

3742
@inline function _fill_getindex(F::AbstractFill, kj::Integer...)
3843
@boundscheck checkbounds(F, kj...)
@@ -142,7 +147,7 @@ Fill{T,0}(x, ::Tuple{}) where T = Fill{T,0,Tuple{}}(convert(T, x)::T, ()) # ambi
142147
@inline size(F::Fill) = map(length, F.axes)
143148

144149
"""
145-
getindex_value(F::AbstractFill)
150+
FillArrays.getindex_value(F::AbstractFill)
146151
147152
Return the value that `F` is filled with.
148153
@@ -572,14 +577,32 @@ sum(x::AbstractZeros) = getindex_value(x)
572577

573578
# needed to support infinite case
574579
steprangelen(st...) = StepRangeLen(st...)
575-
cumsum(x::AbstractFill{<:Any,1}) = steprangelen(getindex_value(x), getindex_value(x), length(x))
580+
function cumsum(x::AbstractFill{T,1}) where T
581+
V = promote_op(add_sum, T, T)
582+
steprangelen(convert(V,getindex_value(x)), getindex_value(x), length(x))
583+
end
576584

577-
cumsum(x::AbstractZerosVector) = x
578-
cumsum(x::AbstractZerosVector{Bool}) = x
579-
cumsum(x::AbstractOnesVector{II}) where II<:Integer = convert(AbstractVector{II}, oneto(length(x)))
585+
cumsum(x::AbstractZerosVector{T}) where T = _range_convert(AbstractVector{promote_op(add_sum, T, T)}, x)
586+
cumsum(x::AbstractZerosVector{Bool}) = _range_convert(AbstractVector{Int}, x)
587+
cumsum(x::AbstractOnesVector{T}) where T<:Integer = _range_convert(AbstractVector{promote_op(add_sum, T, T)}, oneto(length(x)))
580588
cumsum(x::AbstractOnesVector{Bool}) = oneto(length(x))
581589

582590

591+
for op in (:+, :-)
592+
@eval begin
593+
function accumulate(::typeof($op), x::AbstractFill{T,1}) where T
594+
V = promote_op($op, T, T)
595+
steprangelen(convert(V,getindex_value(x)), $op(getindex_value(x)), length(x))
596+
end
597+
598+
accumulate(::typeof($op), x::AbstractZerosVector{T}) where T = _range_convert(AbstractVector{promote_op($op, T, T)}, x)
599+
accumulate(::typeof($op), x::AbstractZerosVector{Bool}) = _range_convert(AbstractVector{Int}, x)
600+
end
601+
end
602+
603+
accumulate(::typeof(+), x::AbstractOnesVector{T}) where T<:Integer = _range_convert(AbstractVector{promote_op(+, T, T)}, oneto(length(x)))
604+
accumulate(::typeof(+), x::AbstractOnesVector{Bool}) = oneto(length(x))
605+
583606
#########
584607
# Diff
585608
#########
@@ -644,8 +667,18 @@ end
644667

645668
# In particular, these make iszero(Eye(n)) efficient.
646669
# use any/all on scalar to get Boolean error message
647-
any(f::Function, x::AbstractFill) = !isempty(x) && any(f(getindex_value(x)))
648-
all(f::Function, x::AbstractFill) = isempty(x) || all(f(getindex_value(x)))
670+
function any(f::Function, x::AbstractFill)
671+
isempty(x) && return false
672+
# If the condition is true for one value, then it's true for all
673+
fval = f(getindex_value(x))
674+
any((fval,))
675+
end
676+
function all(f::Function, x::AbstractFill)
677+
isempty(x) && return true
678+
# If the condition is true for one value, then it's true for all
679+
fval = f(getindex_value(x))
680+
return all((fval,))
681+
end
649682
any(x::AbstractFill) = any(identity, x)
650683
all(x::AbstractFill) = all(identity, x)
651684

0 commit comments

Comments
 (0)