Skip to content

Commit

Permalink
Support 2D quasimatrix sum (#115)
Browse files Browse the repository at this point in the history
* Support 2D quasimatrix sum

* move downstream
  • Loading branch information
dlfivefifty authored Nov 27, 2024
1 parent dc0d49e commit b0741da
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 3 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: IntegrationTest
on:
push:
branches: [master]
tags: [v*]
pull_request:
paths-ignore:
- 'LICENSE'
- 'README.md'
- '.github/workflows/TagBot.yml'

jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
test:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
name: ${{ matrix.package.group }}/${{ matrix.package.repo }}/${{ matrix.julia-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
julia-version: ['1']
os: [ubuntu-latest]
package:
- {repo: ContinuumArrays.jl, group: JuliaApproximation}
- {repo: ClassicalOrthogonalPolynomials.jl, group: JuliaApproximation}

steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
arch: x64
- uses: julia-actions/julia-buildpkg@latest
- name: Clone Downstream
uses: actions/checkout@v4
with:
repository: ${{ matrix.package.group }}/${{ matrix.package.repo }}
path: downstream
- name: Load this and run the downstream tests
shell: julia --color=yes --project=downstream {0}
run: |
using Pkg
try
# force it to use this PR's version of the package
Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps
Pkg.update()
Pkg.test(; coverage = true) # resolver may fail with test time deps
catch err
err isa Pkg.Resolve.ResolverError || rethrow()
# If we can't resolve that means this is incompatible by SemVer and this is fine
# It means we marked this as a breaking change, so we don't need to worry about
# Mistakenly introducing a breaking change, as we have intentionally made one
@info "Not compatible with this release. No problem." exception=err
exit(0) # Exit immediately, as a success
end
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "QuasiArrays"
uuid = "c4ea9172-b204-11e9-377d-29865faadc5c"
authors = ["Sheehan Olver <[email protected]>"]
version = "0.11.8"
version = "0.11.9"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
2 changes: 1 addition & 1 deletion src/QuasiArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Base: getindex, size, axes, axes1, length, ==, isequal, iterate, Cartesia
isreal, iszero, isempty, empty, isapprox, fill!, getproperty, showarg
import Base: @_inline_meta, DimOrInd, OneTo, @_propagate_inbounds_meta, @_noinline_meta,
DimsInteger, error_if_canonical_getindex, @propagate_inbounds, _return_type,
safe_tail, tail, _getindex, _maybe_reshape, index_ndims, _unsafe_getindex,
safe_tail, front, tail, _getindex, _maybe_reshape, index_ndims, _unsafe_getindex,
index_shape, to_shape, @nloops, @ncall, unalias, _unaliascopy,
to_index, to_indices, _to_subscript_indices, _splatmap, dataids,
compute_stride1, compute_offset1, fill_to_length
Expand Down
7 changes: 6 additions & 1 deletion src/calculus.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ end

function sum_layout(LAY::ApplyLayout{typeof(*)}, V::AbstractQuasiVector, ::Colon)
a = arguments(LAY, V)
first(apply(*, sum(a[1]; dims=1), tail(a)...))
only(*(sum(a[1]; dims=1), tail(a)...))
end

function sum_layout(LAY::ApplyLayout{typeof(*)}, V::AbstractQuasiMatrix, ::Colon)
a = arguments(LAY, V)
only(*(sum(a[1]; dims=1), front(tail(a))..., sum(a[end]; dims=2)))
end

sum_layout(::MemoryLayout, A, dims) = sum_size(size(A), A, dims)
Expand Down
1 change: 1 addition & 0 deletions test/test_calculus.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ using QuasiArrays, IntervalSets, Test
@test sum(ApplyQuasiArray(*, A, B)) sum(A*B)
@test sum(ApplyQuasiArray(*, A, B); dims=1) sum(A*B; dims=1)
@test sum(ApplyQuasiArray(*, A, B); dims=2) sum(A*B; dims=2)
@test sum(ApplyQuasiArray(*, A, B)) sum(A*B)

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

2 comments on commit b0741da

@dlfivefifty
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
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/120264

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 v0.11.9 -m "<description of version>" b0741da2444b2fdc74ab1d8b4adfea63e74c05cd
git push origin v0.11.9

Please sign in to comment.