Skip to content

Commit a27fcb3

Browse files
authored
QuasiArrays v0.6 (#97)
* Move _sum to QuasiArrays * import __sum * Drop Julia v1.5 * Update ci.yml * Increase coverage
1 parent eab5d3c commit a27fcb3

File tree

6 files changed

+13
-29
lines changed

6 files changed

+13
-29
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
version:
13-
- '1.5'
14-
- '^1.6.0-0'
13+
- '1.6'
1514
os:
1615
- ubuntu-latest
1716
- macOS-latest

Project.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ContinuumArrays"
22
uuid = "7ae1f121-cc2c-504b-ac30-9b923412ae5c"
3-
version = "0.7.5"
3+
version = "0.8.0"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
@@ -17,18 +17,18 @@ RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1717
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1818

1919
[compat]
20-
ArrayLayouts = "0.6, 0.7"
20+
ArrayLayouts = "0.7"
2121
BandedMatrices = "0.16"
2222
BlockArrays = "0.15.1"
2323
FillArrays = "0.11"
2424
InfiniteArrays = "0.10"
2525
Infinities = "0.1"
2626
IntervalSets = "0.5"
2727
LazyArrays = "0.21"
28-
QuasiArrays = "0.5.1"
28+
QuasiArrays = "0.6"
2929
RecipesBase = "1.0"
30-
StaticArrays = "0.12, 1"
31-
julia = "1.5"
30+
StaticArrays = "1.0"
31+
julia = "1.6"
3232

3333
[extras]
3434
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/ContinuumArrays.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import QuasiArrays: cardinality, checkindex, QuasiAdjoint, QuasiTranspose, Inclu
1818
QuasiDiagonal, MulQuasiArray, MulQuasiMatrix, MulQuasiVector, QuasiMatMulMat,
1919
ApplyQuasiArray, ApplyQuasiMatrix, LazyQuasiArrayApplyStyle, AbstractQuasiArrayApplyStyle, AbstractQuasiLazyLayout,
2020
LazyQuasiArray, LazyQuasiVector, LazyQuasiMatrix, LazyLayout, LazyQuasiArrayStyle, _factorize,
21-
AbstractQuasiFill, UnionDomain
21+
AbstractQuasiFill, UnionDomain, __sum
2222
import InfiniteArrays: Infinity, InfAxes
2323

2424
export Spline, LinearSpline, HeavisideSpline, DiracDelta, Derivative, ℵ₁, Inclusion, Basis, WeightedBasis, grid, plotgrid, transform, affine, ..

src/bases/bases.jl

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -391,32 +391,14 @@ end
391391
# sum
392392
####
393393

394-
_sum(V::AbstractQuasiArray, dims) = __sum(MemoryLayout(typeof(V)), V, dims)
395-
_sum(V::AbstractQuasiArray, ::Colon) = __sum(MemoryLayout(typeof(V)), V, :)
396-
sum(V::AbstractQuasiArray; dims=:) = _sum(V, dims)
397394

398-
__sum(L, Vm, _) = error("Override for $L")
399395
function __sum(::SubBasisLayout, Vm, dims)
400396
@assert dims == 1
401397
sum(parent(Vm); dims=dims)[:,parentindices(Vm)[2]]
402398
end
403-
function __sum(LAY::ApplyLayout{typeof(*)}, V::AbstractQuasiVector, ::Colon)
404-
a = arguments(LAY, V)
405-
first(apply(*, sum(a[1]; dims=1), tail(a)...))
406-
end
407399

408400
__sum(::AdjointBasisLayout, Vm::AbstractQuasiMatrix, dims) = permutedims(sum(Vm'; dims=(isone(dims) ? 2 : 1)))
409401

410-
# sum is equivalent to hitting by ones(n) on the left or rifght
411-
function __sum(LAY::ApplyLayout{typeof(*)}, V::AbstractQuasiMatrix, d::Int)
412-
a = arguments(LAY, V)
413-
if d == 1
414-
*(sum(first(a); dims=1), tail(a)...)
415-
else
416-
@assert d == 2
417-
*(most(a)..., sum(last(a); dims=2))
418-
end
419-
end
420402

421403
function __sum(::MappedBasisLayouts, V::AbstractQuasiArray, dims)
422404
kr = basismap(V)

src/operators.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ function getindex(δ::DiracDelta{T}, x::Number) where T
8484
end
8585

8686

87-
@simplify *(A::QuasiAdjoint{<:Any,<:DiracDelta}, B::AbstractQuasiVector) = B[parent(A).x]
8887
@simplify *(A::QuasiAdjoint{<:Any,<:DiracDelta}, B::AbstractQuasiMatrix) = B[parent(A).x,:]
88+
dot::DiracDelta, B::AbstractQuasiVector) = B[δ.x]
89+
@simplify *(A::QuasiAdjoint{<:Any,<:DiracDelta}, B::AbstractQuasiVector) = dot(parent(A),B)
8990

9091
show(io::IO, δ::DiracDelta) = print(io, "δ at $(δ.x) over $(axes(δ,1))")
9192
show(io::IO, ::MIME"text/plain", δ::DiracDelta) = show(io, δ)
@@ -99,7 +100,7 @@ struct Derivative{T,D} <: LazyQuasiMatrix{T}
99100
axis::Inclusion{T,D}
100101
end
101102

102-
Derivative{T}(axis::A) where {T,A<:Inclusion} = Derivative{T,A}(axis)
103+
Derivative{T}(axis::Inclusion{<:Any,D}) where {T,D} = Derivative{T,D}(axis)
103104
Derivative{T}(domain) where T = Derivative{T}(Inclusion(domain))
104105

105106
axes(D::Derivative) = (D.axis, D.axis)

test/runtests.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using ContinuumArrays, QuasiArrays, LazyArrays, IntervalSets, FillArrays, LinearAlgebra, BandedMatrices, FastTransforms, InfiniteArrays, Test, Base64, RecipesBase
22
import ContinuumArrays: ℵ₁, materialize, AffineQuasiVector, BasisLayout, AdjointBasisLayout, SubBasisLayout, ℵ₁,
33
MappedBasisLayout, AdjointMappedBasisLayout, MappedWeightedBasisLayout, TransformFactorization, Weight, WeightedBasisLayout, SubWeightedBasisLayout, WeightLayout,
4-
Expansion, basis, invmap, Map, checkpoints, _plotgrid
4+
Expansion, basis, invmap, Map, checkpoints, _plotgrid, mul
55
import QuasiArrays: SubQuasiArray, MulQuasiMatrix, Vec, Inclusion, QuasiDiagonal, LazyQuasiArrayApplyStyle, LazyQuasiArrayStyle
66
import LazyArrays: MemoryLayout, ApplyStyle, Applied, colsupport, arguments, ApplyLayout, LdivStyle, MulStyle
77

@@ -34,6 +34,7 @@ import LazyArrays: MemoryLayout, ApplyStyle, Applied, colsupport, arguments, App
3434
@testset "Derivative" begin
3535
x = Inclusion(-1..1)
3636
D = Derivative(x)
37+
@test D == Derivative{Float64}(x) == Derivative{Float64}(-1..1)
3738
@test D*x QuasiOnes(x)
3839
@test D^2 * x QuasiZeros(x)
3940
@test D*[x D*x] == [D*x D^2*x]
@@ -137,6 +138,7 @@ end
137138
δ = DiracDelta(1.2,1..3)
138139
L = LinearSpline([1,2,3])
139140
@test @inferred'L) [0.8, 0.2, 0.0]
141+
@test δ'f == mul',f) == dot(δ,f) == f[1.2]
140142

141143
@test @inferred(L'L) == SymTridiagonal([1/3,2/3,1/3], [1/6,1/6])
142144

0 commit comments

Comments
 (0)