Skip to content

Commit b0741da

Browse files
authored
Support 2D quasimatrix sum (#115)
* Support 2D quasimatrix sum * move downstream
1 parent dc0d49e commit b0741da

File tree

5 files changed

+78
-3
lines changed

5 files changed

+78
-3
lines changed

.github/workflows/downstream.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: IntegrationTest
2+
on:
3+
push:
4+
branches: [master]
5+
tags: [v*]
6+
pull_request:
7+
paths-ignore:
8+
- 'LICENSE'
9+
- 'README.md'
10+
- '.github/workflows/TagBot.yml'
11+
12+
jobs:
13+
pre_job:
14+
# continue-on-error: true # Uncomment once integration is finished
15+
runs-on: ubuntu-latest
16+
# Map a step output to a job output
17+
outputs:
18+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
19+
steps:
20+
- id: skip_check
21+
uses: fkirc/skip-duplicate-actions@v5
22+
test:
23+
needs: pre_job
24+
if: needs.pre_job.outputs.should_skip != 'true'
25+
name: ${{ matrix.package.group }}/${{ matrix.package.repo }}/${{ matrix.julia-version }}
26+
runs-on: ${{ matrix.os }}
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
julia-version: ['1']
31+
os: [ubuntu-latest]
32+
package:
33+
- {repo: ContinuumArrays.jl, group: JuliaApproximation}
34+
- {repo: ClassicalOrthogonalPolynomials.jl, group: JuliaApproximation}
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: julia-actions/setup-julia@v2
39+
with:
40+
version: ${{ matrix.julia-version }}
41+
arch: x64
42+
- uses: julia-actions/julia-buildpkg@latest
43+
- name: Clone Downstream
44+
uses: actions/checkout@v4
45+
with:
46+
repository: ${{ matrix.package.group }}/${{ matrix.package.repo }}
47+
path: downstream
48+
- name: Load this and run the downstream tests
49+
shell: julia --color=yes --project=downstream {0}
50+
run: |
51+
using Pkg
52+
try
53+
# force it to use this PR's version of the package
54+
Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps
55+
Pkg.update()
56+
Pkg.test(; coverage = true) # resolver may fail with test time deps
57+
catch err
58+
err isa Pkg.Resolve.ResolverError || rethrow()
59+
# If we can't resolve that means this is incompatible by SemVer and this is fine
60+
# It means we marked this as a breaking change, so we don't need to worry about
61+
# Mistakenly introducing a breaking change, as we have intentionally made one
62+
@info "Not compatible with this release. No problem." exception=err
63+
exit(0) # Exit immediately, as a success
64+
end
65+
- uses: julia-actions/julia-processcoverage@v1
66+
- uses: codecov/codecov-action@v5
67+
with:
68+
token: ${{ secrets.CODECOV_TOKEN }}
69+
files: lcov.info

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "QuasiArrays"
22
uuid = "c4ea9172-b204-11e9-377d-29865faadc5c"
33
authors = ["Sheehan Olver <solver@mac.com>"]
4-
version = "0.11.8"
4+
version = "0.11.9"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/QuasiArrays.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Base: getindex, size, axes, axes1, length, ==, isequal, iterate, Cartesia
66
isreal, iszero, isempty, empty, isapprox, fill!, getproperty, showarg
77
import Base: @_inline_meta, DimOrInd, OneTo, @_propagate_inbounds_meta, @_noinline_meta,
88
DimsInteger, error_if_canonical_getindex, @propagate_inbounds, _return_type,
9-
safe_tail, tail, _getindex, _maybe_reshape, index_ndims, _unsafe_getindex,
9+
safe_tail, front, tail, _getindex, _maybe_reshape, index_ndims, _unsafe_getindex,
1010
index_shape, to_shape, @nloops, @ncall, unalias, _unaliascopy,
1111
to_index, to_indices, _to_subscript_indices, _splatmap, dataids,
1212
compute_stride1, compute_offset1, fill_to_length

src/calculus.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ end
3333

3434
function sum_layout(LAY::ApplyLayout{typeof(*)}, V::AbstractQuasiVector, ::Colon)
3535
a = arguments(LAY, V)
36-
first(apply(*, sum(a[1]; dims=1), tail(a)...))
36+
only(*(sum(a[1]; dims=1), tail(a)...))
37+
end
38+
39+
function sum_layout(LAY::ApplyLayout{typeof(*)}, V::AbstractQuasiMatrix, ::Colon)
40+
a = arguments(LAY, V)
41+
only(*(sum(a[1]; dims=1), front(tail(a))..., sum(a[end]; dims=2)))
3742
end
3843

3944
sum_layout(::MemoryLayout, A, dims) = sum_size(size(A), A, dims)

test/test_calculus.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ using QuasiArrays, IntervalSets, Test
1717
@test sum(ApplyQuasiArray(*, A, B)) sum(A*B)
1818
@test sum(ApplyQuasiArray(*, A, B); dims=1) sum(A*B; dims=1)
1919
@test sum(ApplyQuasiArray(*, A, B); dims=2) sum(A*B; dims=2)
20+
@test sum(ApplyQuasiArray(*, A, B)) sum(A*B)
2021

2122
@test sum(b) last(cumsum(b)) cumsum(b)[2]
2223
@test cumsum(B)[2:2,:] cumsum(B; dims=1)[2:2,:] sum(B; dims=1)

0 commit comments

Comments
 (0)