Skip to content

Commit b4512c7

Browse files
authored
Support broadcasting mixed with operators (#37)
* Support broadcasting and operators * Update test_fourier.jl * Update Project.toml * Drop Julia v1.5 * update Project * Increase coverage
1 parent 4598ff4 commit b4512c7

File tree

8 files changed

+33
-15
lines changed

8 files changed

+33
-15
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: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClassicalOrthogonalPolynomials"
22
uuid = "b30e2e7b-c4ee-47da-9d5f-2c5c27239acd"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "0.3.7"
4+
version = "0.4"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
@@ -25,25 +25,25 @@ QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c"
2525
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2626

2727
[compat]
28-
ArrayLayouts = "0.6.2, 0.7"
28+
ArrayLayouts = "0.7"
2929
BandedMatrices = "0.16.5"
3030
BlockArrays = "0.15"
3131
BlockBandedMatrices = "0.10"
32-
ContinuumArrays = "0.7.3"
32+
ContinuumArrays = "0.8"
3333
DomainSets = "0.4, 0.5"
3434
FFTW = "1.1"
3535
FastGaussQuadrature = "0.4.3"
36-
FastTransforms = "0.11, 0.12"
36+
FastTransforms = "0.12"
3737
FillArrays = "0.11"
3838
HypergeometricFunctions = "0.3.4"
3939
InfiniteArrays = "0.10.3"
4040
InfiniteLinearAlgebra = "0.5.3"
4141
IntervalSets = "0.5"
4242
LazyArrays = "0.21"
4343
LazyBandedMatrices = "0.5.5"
44-
QuasiArrays = "0.5"
45-
SpecialFunctions = "0.10, 1"
46-
julia = "1.5"
44+
QuasiArrays = "0.6"
45+
SpecialFunctions = "1"
46+
julia = "1.6"
4747

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

src/ClassicalOrthogonalPolynomials.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import LazyArrays: MemoryLayout, Applied, ApplyStyle, flatten, _flatten, colsupp
1515
AbstractCachedVector, AbstractCachedMatrix
1616
import ArrayLayouts: MatMulVecAdd, materialize!, _fill_lmul!, sublayout, sub_materialize, lmul!, ldiv!, ldiv, transposelayout, triangulardata,
1717
subdiagonaldata, diagonaldata, supdiagonaldata
18-
import LazyBandedMatrices: SymTridiagonal, Bidiagonal, Tridiagonal
19-
import LinearAlgebra: pinv, factorize, qr, adjoint, transpose
18+
import LazyBandedMatrices: SymTridiagonal, Bidiagonal, Tridiagonal, AbstractLazyBandedLayout
19+
import LinearAlgebra: pinv, factorize, qr, adjoint, transpose, dot
2020
import BandedMatrices: AbstractBandedLayout, AbstractBandedMatrix, _BandedMatrix, bandeddata
2121
import FillArrays: AbstractFill, getindex_value
2222

@@ -46,7 +46,7 @@ export OrthogonalPolynomial, Normalized, orthonormalpolynomial, LanczosPolynomia
4646
∞, Derivative, .., Inclusion,
4747
chebyshevt, chebyshevu, legendre, jacobi,
4848
legendrep, jacobip, ultrasphericalc, laguerrel,hermiteh, normalizedjacobip,
49-
jacobimatrix, jacobiweight, legendreweight, chebyshevtweight, chebyshevuweight
49+
jacobimatrix, jacobiweight, legendreweight, chebyshevtweight, chebyshevuweight, Weighted
5050

5151
if VERSION < v"1.6-"
5252
oneto(n) = Base.OneTo(n)

src/clenshaw.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ bandwidths(M::Clenshaw) = (length(M.c)-1,length(M.c)-1)
263263
Base.array_summary(io::IO, C::Clenshaw{T}, inds::Tuple{Vararg{OneToInf{Int}}}) where T =
264264
print(io, Base.dims2string(length.(inds)), " Clenshaw{$T} with $(length(C.c)) degree polynomial")
265265

266-
struct ClenshawLayout <: AbstractBandedLayout end
266+
struct ClenshawLayout <: AbstractLazyBandedLayout end
267267
MemoryLayout(::Type{<:Clenshaw}) = ClenshawLayout()
268268
sublayout(::ClenshawLayout, ::Type{<:NTuple{2,AbstractUnitRange{Int}}}) = ClenshawLayout()
269269
sub_materialize(::ClenshawLayout, V) = BandedMatrix(V)

test/test_chebyshev.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,12 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map
130130

131131
@testset "Weighted" begin
132132
WT = Weighted(ChebyshevT())
133+
@test WT == copy(WT)
134+
@test WT \ WT == Eye(∞)
133135
@test wT[0.1,1:10] WT[0.1,1:10]
134136
@test WT \ (exp.(x) ./ sqrt.(1 .- x.^2)) wT \ (exp.(x) ./ sqrt.(1 .- x.^2))
135137
@test WT[:,1:20] \ (exp.(x) ./ sqrt.(1 .- x.^2)) (WT \ (exp.(x) ./ sqrt.(1 .- x.^2)))[1:20]
138+
@test WT \ (x .* WT) == T \ (x .* T)
136139
end
137140

138141
@testset "mapped" begin

test/test_fourier.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import QuasiArrays: MulQuasiArray
3939
@test blockisequal(axes(F'F), (axes(F,2),axes(F,2)))
4040
D = Derivative(axes(F,1))
4141
= (D*F).args[2]
42-
@test BlockArrays.blockcolsupport(D̃,Block(3)) == Block.(3:3)
4342
@test (F\F)*isa BlockArray
4443
@test (F \ (D*F))[Block.(1:3),Block.(1:3)] == [0 0 0 0 0; 0 0.0 -1 0 0; 0 1 0 0 0; 0 0 0 0 -2; 0 0 0 2 0]
4544

test/test_normalized.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using ClassicalOrthogonalPolynomials, FillArrays, BandedMatrices, ContinuumArrays, ArrayLayouts, LazyArrays, Base64, Test
1+
using ClassicalOrthogonalPolynomials, FillArrays, BandedMatrices, ContinuumArrays, ArrayLayouts, LazyArrays, Base64, LinearAlgebra, Test
22
import ClassicalOrthogonalPolynomials: NormalizedBasisLayout, recurrencecoefficients, Normalized, Clenshaw, weighted
33
import LazyArrays: CachedVector, PaddedLayout
44
import ContinuumArrays: MappedWeightedBasisLayout
@@ -80,6 +80,13 @@ import ContinuumArrays: MappedWeightedBasisLayout
8080
@testset "show" begin
8181
@test stringmime("text/plain", Normalized(Legendre())) == "Normalized(Legendre{Float64})"
8282
end
83+
84+
@testset "qr" begin
85+
P = Legendre()
86+
Q,R = qr(P)
87+
@test Q == Normalized(Legendre())
88+
@test R[1:10,1:10] == (P\Q)[1:10,1:10]
89+
end
8390
end
8491

8592
@testset "Chebyshev" begin

test/test_odes.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,14 @@ import SemiseparableMatrices: VcatAlmostBandedLayout
170170
u = L \ [airyai(-ε^(-2/3)); airyai^(2/3)); zeros(∞)]
171171
@test T[-0.1,:]'u airyai(-0.1*ε^(-2/3))
172172
end
173+
174+
@testset "combo operators" begin
175+
T = Chebyshev()
176+
C = Ultraspherical(2)
177+
x = axes(T,1)
178+
D = Derivative(x)
179+
L = x .* D + cos.(x) .* D^2
180+
M = C \ (L * T)
181+
@test C[0.1,:]' * (M * (T \ exp.(x))) (0.1 + cos(0.1))*exp(0.1)
182+
end
173183
end

0 commit comments

Comments
 (0)