Skip to content

Commit 861797d

Browse files
authored
Better support for lowering conversions (#5)
* Better support for lowering conversions * Update lanczos.jl * Update lanczos.jl * Update Project.toml * Update ci.yml * tests pass on 1.6 * Update Project.toml
1 parent bb2a9f1 commit 861797d

16 files changed

+92
-36
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
matrix:
1212
version:
1313
- '1.5'
14+
- '^1.6.0-0'
1415
os:
1516
- ubuntu-latest
1617
- macOS-latest

Project.toml

Lines changed: 4 additions & 4 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.1.0"
4+
version = "0.1.1"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
@@ -24,7 +24,7 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2424

2525
[compat]
2626
ArrayLayouts = "0.5.3"
27-
BandedMatrices = "0.16.2"
27+
BandedMatrices = "0.16.4"
2828
BlockArrays = "0.14.1"
2929
BlockBandedMatrices = "0.10"
3030
ContinuumArrays = "0.5"
@@ -36,8 +36,8 @@ FillArrays = "0.11"
3636
InfiniteArrays = "0.9"
3737
InfiniteLinearAlgebra = "0.4.6"
3838
IntervalSets = "0.3.1, 0.4, 0.5"
39-
LazyArrays = "0.20.4"
40-
QuasiArrays = "0.4.2"
39+
LazyArrays = "0.20.5"
40+
QuasiArrays = "0.4.5"
4141
SpecialFunctions = "0.10, 1"
4242
julia = "1.5"
4343

src/ClassicalOrthogonalPolynomials.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,15 @@ export OrthogonalPolynomial, Normalized, orthonormalpolynomial, LanczosPolynomia
4040
WeightedUltraspherical, WeightedChebyshev, WeightedChebyshevT, WeightedChebyshevU, WeightedJacobi,
4141
∞, Derivative, .., Inclusion, chebyshevt, chebyshevu, legendre, jacobi, legendrep, jacobip, ultrasphericalp, jacobimatrix, jacobiweight, legendreweight, chebyshevtweight, chebyshevuweight
4242

43+
if VERSION < v"1.6-"
44+
oneto(n) = Base.OneTo(n)
45+
else
46+
import Base: oneto
47+
end
48+
4349

4450
include("interlace.jl")
45-
51+
4652

4753
cardinality(::FullSpace{<:AbstractFloat}) = ℵ₁
4854
cardinality(::EuclideanDomain) = ℵ₁
@@ -75,7 +81,7 @@ function adaptivetransform_ldiv(A::AbstractQuasiArray{U}, f::AbstractQuasiArray{
7581
tol = 20eps(real(T))
7682

7783
for n = 2 .^ (4:∞)
78-
An = A[:,OneTo(n)]
84+
An = A[:,oneto(n)]
7985
cfs = An \ f
8086
maxabsc = maximum(abs, cfs)
8187
if maxabsc == 0 && maxabsfr == 0
@@ -121,9 +127,9 @@ satisfying for `x in axes(P,1)`
121127
P[x,2] == (A[1]*x + B[1])*P[x,1]
122128
P[x,n+1] == (A[n]*x + B[n])*P[x,n] - C[n]*P[x,n-1]
123129
```
124-
Note that `C[1]`` is unused.
130+
Note that `C[1]`` is unused.
125131
126-
The relationship with the Jacobi matrix is:
132+
The relationship with the Jacobi matrix is:
127133
```julia
128134
1/A[n] == X[n+1,n]
129135
-B[n]/A[n] == X[n,n]
@@ -234,7 +240,7 @@ factorize(L::SubQuasiArray{T,2,<:OrthogonalPolynomial,<:Tuple{<:Inclusion,<:OneT
234240

235241
function factorize(L::SubQuasiArray{T,2,<:OrthogonalPolynomial,<:Tuple{<:Inclusion,<:AbstractUnitRange}}) where T
236242
_,jr = parentindices(L)
237-
ProjectionFactorization(factorize(parent(L)[:,Base.OneTo(maximum(jr))]), jr)
243+
ProjectionFactorization(factorize(parent(L)[:,oneto(maximum(jr))]), jr)
238244
end
239245

240246
function \(A::SubQuasiArray{<:Any,2,<:OrthogonalPolynomial}, B::SubQuasiArray{<:Any,2,<:OrthogonalPolynomial})

src/chebyshev.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ function \(w_A::WeightedChebyshevT, w_B::WeightedChebyshevU)
173173
_BandedMatrix(Vcat(Fill(one(T)/2, 1, ∞), Zeros{T}(1, ∞), Fill(-one(T)/2, 1, ∞)), ∞, 2, 0)
174174
end
175175

176+
\(T::ChebyshevT, U::ChebyshevU) = inv(U \ T)
176177

177178
####
178179
# interrelationships

src/clenshaw.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ end
6767
getindex(P::OrthogonalPolynomial, x::Number, n::AbstractVector) = layout_getindex(P, x, n)
6868
getindex(P::OrthogonalPolynomial, x::AbstractVector, n::AbstractVector) = layout_getindex(P, x, n)
6969
getindex(P::SubArray{<:Any,1,<:OrthogonalPolynomial}, x::AbstractVector) = layout_getindex(P, x)
70-
getindex(P::OrthogonalPolynomial, x::Number, n::Number) = P[x,OneTo(n)][end]
70+
getindex(P::OrthogonalPolynomial, x::Number, n::Number) = P[x,oneto(n)][end]
7171

7272
unsafe_layout_getindex(A...) = sub_materialize(Base.unsafe_view(A...))
7373

7474
Base.unsafe_getindex(P::OrthogonalPolynomial, x::Number, n::AbstractUnitRange) = unsafe_layout_getindex(P, x, n)
7575
Base.unsafe_getindex(P::OrthogonalPolynomial, x::AbstractVector, n::AbstractUnitRange) = unsafe_layout_getindex(P, x, n)
76-
Base.unsafe_getindex(P::OrthogonalPolynomial, x::Number, n::AbstractVector) = Base.unsafe_getindex(P,x,OneTo(maximum(n)))[n]
77-
Base.unsafe_getindex(P::OrthogonalPolynomial, x::AbstractVector, n::AbstractVector) = Base.unsafe_getindex(P,x,OneTo(maximum(n)))[:,n]
76+
Base.unsafe_getindex(P::OrthogonalPolynomial, x::Number, n::AbstractVector) = Base.unsafe_getindex(P,x,oneto(maximum(n)))[n]
77+
Base.unsafe_getindex(P::OrthogonalPolynomial, x::AbstractVector, n::AbstractVector) = Base.unsafe_getindex(P,x,oneto(maximum(n)))[:,n]
7878
Base.unsafe_getindex(P::OrthogonalPolynomial, x::AbstractVector, n::Number) = Base.unsafe_getindex(P, x, 1:n)[:,end]
7979
Base.unsafe_getindex(P::OrthogonalPolynomial, x::Number, ::Colon) = Base.unsafe_getindex(P, x, axes(P,2))
80-
Base.unsafe_getindex(P::OrthogonalPolynomial, x::Number, n::Number) = Base.unsafe_getindex(P,x,OneTo(n))[end]
80+
Base.unsafe_getindex(P::OrthogonalPolynomial, x::Number, n::Number) = Base.unsafe_getindex(P,x,oneto(n))[end]
8181

8282
getindex(P::OrthogonalPolynomial, x::Number, jr::AbstractInfUnitRange{Int}) = view(P, x, jr)
8383
Base.unsafe_getindex(P::OrthogonalPolynomial{T}, x::Number, jr::AbstractInfUnitRange{Int}) where T =

src/hermite.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct Hermite{T} <: OrthogonalPolynomial{T} end
1212
Hermite() = Hermite{Float64}()
1313

1414
==(::Hermite, ::Hermite) = true
15-
axes(::Hermite{T}) where T = (Inclusion(ℝ), OneTo(∞))
15+
axes(::Hermite{T}) where T = (Inclusion(ℝ), oneto(∞))
1616

1717
# H_{n+1} = 2x H_n - 2n H_{n-1}
1818
# 1/2 * H_{n+1} + n H_{n-1} = x H_n

src/jacobi.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ WeightedJacobi(a,b) = JacobiWeight(a,b) .* Jacobi(a,b)
141141
WeightedJacobi{T}(a,b) where T = JacobiWeight{T}(a,b) .* Jacobi{T}(a,b)
142142

143143

144-
axes(::AbstractJacobi{T}) where T = (Inclusion{T}(ChebyshevInterval{real(T)}()), OneTo(∞))
144+
axes(::AbstractJacobi{T}) where T = (Inclusion{T}(ChebyshevInterval{real(T)}()), oneto(∞))
145145
==(P::Jacobi, Q::Jacobi) = P.a == Q.a && P.b == Q.b
146146
==(P::Legendre, Q::Jacobi) = Jacobi(P) == Q
147147
==(P::Jacobi, Q::Legendre) = P == Jacobi(Q)
@@ -276,6 +276,8 @@ function \(A::Jacobi, B::Jacobi)
276276
elseif A.b b+1
277277
J = Jacobi(a,b+1)
278278
(A \ J) * (J \ B)
279+
elseif isinteger(A.a-a) && isinteger(A.b-b)
280+
inv(B \ A)
279281
else
280282
error("not implemented for $A and $B")
281283
end

src/lanczos.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@ getindex(R::LanczosConversion, k::AbstractUnitRange, j::AbstractUnitRange) = _la
8282

8383
inv(R::LanczosConversion) = ApplyArray(inv, R)
8484

85+
86+
Base.BroadcastStyle(::Type{<:LanczosConversion}) = LazyArrays.LazyArrayStyle{2}()
87+
8588
struct LanczosConversionLayout <: AbstractLazyLayout end
89+
90+
LazyArrays.simplifiable(::Mul{LanczosConversionLayout,<:PaddedLayout}) = Val(true)
8691
function copy(M::Mul{LanczosConversionLayout,<:PaddedLayout})
8792
resizedata!(M.A.data, maximum(colsupport(M.B)))
8893
M.A.data.R * M.B
@@ -107,7 +112,7 @@ function sub_paddeddata(::LanczosConversionLayout, S::SubArray{<:Any,1,<:Abstrac
107112
P = parent(S)
108113
(kr,j) = parentindices(S)
109114
resizedata!(P.data, j)
110-
paddeddata(view(P.data.R, kr, j))
115+
paddeddata(view(UpperTriangular(P.data.R.data.data), kr, j))
111116
end
112117

113118
# struct LanczosJacobiMatrix{T,XX,WW} <: AbstractBandedMatrix{T}

src/ultraspherical.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ function \(U::Ultraspherical{<:Any,<:Integer}, C::ChebyshevU)
141141
U\Ultraspherical(C)
142142
end
143143

144+
\(T::Chebyshev, C::Ultraspherical) = inv(C \ T)
145+
144146
function \(C2::Ultraspherical{<:Any,<:Integer}, C1::Ultraspherical{<:Any,<:Integer})
145147
λ = C1.λ
146148
T = promote_type(eltype(C2), eltype(C1))
@@ -162,6 +164,11 @@ function \(C2::Ultraspherical, C1::Ultraspherical)
162164
_BandedMatrix( Vcat(-./ ((0:∞) .+ λ))', Zeros(1,∞), (λ ./ ((0:∞) .+ λ))'), ∞, 0, 2)
163165
elseif C2.λ == λ
164166
Eye{T}(∞)
167+
elseif isinteger(C2.λ-λ) && C2.λ > λ
168+
Cm = Ultraspherical{T}+1)
169+
(C2 \ Cm) * (Cm \ C1)
170+
elseif isinteger(C2.λ-λ)
171+
inv(C1 \ C2)
165172
else
166173
error("Not implemented")
167174
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import ClassicalOrthogonalPolynomials: jacobimatrix, ∞, ChebyshevInterval, Leg
88
import LazyArrays: ApplyStyle, colsupport, MemoryLayout, arguments
99
import SemiseparableMatrices: VcatAlmostBandedLayout
1010
import QuasiArrays: MulQuasiMatrix
11-
import Base: OneTo
11+
import ClassicalOrthogonalPolynomials: oneto
1212
import InfiniteLinearAlgebra: KronTrav, Block
1313
import FastTransforms: clenshaw!
1414

test/test_chebyshev.jl

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map
2020
@testset "Evaluation" begin
2121
@testset "T" begin
2222
T = Chebyshev()
23-
@test @inferred(T[0.1,Base.OneTo(0)]) == Float64[]
24-
@test @inferred(T[0.1,Base.OneTo(1)]) == [1.0]
25-
@test @inferred(T[0.1,Base.OneTo(2)]) == [1.0,0.1]
23+
@test @inferred(T[0.1,oneto(0)]) == Float64[]
24+
@test @inferred(T[0.1,oneto(1)]) == [1.0]
25+
@test @inferred(T[0.1,oneto(2)]) == [1.0,0.1]
2626
for N = 1:10
27-
@test @inferred(T[0.1,Base.OneTo(N)]) @inferred(T[0.1,1:N]) cos.((0:N-1)*acos(0.1))
27+
@test @inferred(T[0.1,oneto(N)]) @inferred(T[0.1,1:N]) cos.((0:N-1)*acos(0.1))
2828
@test @inferred(T[0.1,N]) cos((N-1)*acos(0.1))
2929
end
3030
@test T[0.1,[2,5,10]] [0.1,cos(4acos(0.1)),cos(9acos(0.1))]
3131

32-
@test axes(T[1:1,:]) === (Base.OneTo(1), Base.OneTo(∞))
32+
@test axes(T[1:1,:]) === (oneto(1), oneto(∞))
3333
@test T[1:1,:][:,1:5] == ones(1,5)
3434
@test T[0.1,:][1:10] T[0.1,1:10] (T')[1:10,0.1]
3535
end
3636

3737
@testset "U" begin
3838
U = ChebyshevU()
39-
@test @inferred(U[0.1,Base.OneTo(0)]) == Float64[]
40-
@test @inferred(U[0.1,Base.OneTo(1)]) == [1.0]
41-
@test @inferred(U[0.1,Base.OneTo(2)]) == [1.0,0.2]
39+
@test @inferred(U[0.1,oneto(0)]) == Float64[]
40+
@test @inferred(U[0.1,oneto(1)]) == [1.0]
41+
@test @inferred(U[0.1,oneto(2)]) == [1.0,0.2]
4242
for N = 1:10
43-
@test @inferred(U[0.1,Base.OneTo(N)]) @inferred(U[0.1,1:N]) [sin((n+1)*acos(0.1))/sin(acos(0.1)) for n = 0:N-1]
43+
@test @inferred(U[0.1,oneto(N)]) @inferred(U[0.1,1:N]) [sin((n+1)*acos(0.1))/sin(acos(0.1)) for n = 0:N-1]
4444
@test @inferred(U[0.1,N]) sin(N*acos(0.1))/sin(acos(0.1))
4545
end
4646
@test U[0.1,[2,5,10]] [0.2,sin(5acos(0.1))/sin(acos(0.1)),sin(10acos(0.1))/sin(acos(0.1))]
@@ -59,7 +59,7 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map
5959
@testset "ChebyshevT" begin
6060
T = Chebyshev()
6161
@test T == ChebyshevT() == chebyshevt()
62-
Tn = @inferred(T[:,OneTo(100)])
62+
Tn = @inferred(T[:,oneto(100)])
6363
@test grid(Tn) == chebyshevpoints(100, Val(1))
6464
P = factorize(Tn)
6565
u = T*[P.plan * exp.(grid(Tn)); zeros(∞)]
@@ -89,7 +89,7 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map
8989
@test U == chebyshevu()
9090
@test U  ChebyshevT()
9191
x = axes(U,1)
92-
F = factorize(U[:,Base.OneTo(5)])
92+
F = factorize(U[:,oneto(5)])
9393
@test @inferred(F \ x) [0,0.5,0,0,0]
9494
v = (x -> (3/20 + x + (2/5) * x^2)*exp(x)).(x)
9595
@inferred(U[:,Base.OneTo(5)]\v)
@@ -140,7 +140,7 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map
140140
@testset "operators" begin
141141
T = ChebyshevT()
142142
U = ChebyshevU()
143-
@test axes(T) == axes(U) == (Inclusion(ChebyshevInterval()),Base.OneTo(∞))
143+
@test axes(T) == axes(U) == (Inclusion(ChebyshevInterval()),oneto(∞))
144144
D = Derivative(axes(T,1))
145145

146146
@test T\T === pinv(T)*T === Eye(∞)
@@ -161,6 +161,10 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map
161161
J = T\(x.*T)
162162
@test J isa BandedMatrix
163163
@test J[1:10,1:10] == jacobimatrix(T)[1:10,1:10]
164+
165+
@testset "inv" begin
166+
@test (T \ U)[1:10,1:10] inv((U \ T)[1:10,1:10])
167+
end
164168
end
165169

166170
@testset "test on functions" begin
@@ -261,7 +265,11 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map
261265

262266
@testset "show" begin
263267
T = Chebyshev()
264-
@test stringmime("text/plain", T * [1; 2; Zeros(∞)]) == "Chebyshev{1,Float64} * [1.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, …]"
268+
if VERSION < v"1.6-"
269+
@test stringmime("text/plain", T * [1; 2; Zeros(∞)]) == "Chebyshev{1,Float64} * [1.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, …]"
270+
else
271+
@test stringmime("text/plain", T * [1; 2; Zeros(∞)]) == "ChebyshevT{Float64} * [1.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, …]"
272+
end
265273
end
266274

267275
@testset "Complex eltype" begin

test/test_hermite.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ClassicalOrthogonalPolynomials: jacobimatrix
33

44
@testset "Hermite" begin
55
H = Hermite()
6-
@test axes(H) == (Inclusion(ℝ), Base.OneTo(∞))
6+
@test axes(H) == (Inclusion(ℝ), oneto(∞))
77
x = axes(H,1)
88
X = jacobimatrix(H)
99

test/test_jacobi.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ import ClassicalOrthogonalPolynomials: recurrencecoefficients, basis, MulQuasiMa
105105
@test A[1:10,1:10] == I
106106
end
107107

108+
@testset "Conversion" begin
109+
A,B = Jacobi(0.25,-0.7), Jacobi(3.25,1.3)
110+
R = B \ A
111+
c = [[1,2,3,4,5]; zeros(∞)]
112+
@test B[0.1,:]' * (R * c) A[0.1,:]' * c
113+
Ri = A \ B
114+
@test Ri[1:10,1:10] inv(R[1:10,1:10])
115+
@test A[0.1,:]' * (Ri * c) B[0.1,:]' * c
116+
end
117+
108118
@testset "Derivative" begin
109119
a,b,c = 0.1,0.2,0.3
110120
S = Jacobi(a,b)

test/test_legendre.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import QuasiArrays: MulQuasiArray
1212

1313
@testset "basics" begin
1414
P = Legendre()
15-
@test axes(P) == (Inclusion(ChebyshevInterval()),Base.OneTo(∞))
15+
@test axes(P) == (Inclusion(ChebyshevInterval()),oneto(∞))
1616
@test P == P == Legendre{Float32}()
1717
A,B,C = recurrencecoefficients(P)
1818
@test B isa Zeros

test/test_odes.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ import SemiseparableMatrices: VcatAlmostBandedLayout
5656
B = BroadcastArray(+, Δ, (P\WS)'*(P'P)*(P\WS))
5757
@test colsupport(B,1) == 1:3
5858

59-
@test axes(B.args[2].args[1]) == (Base.OneTo(∞),Base.OneTo(∞))
60-
@test axes(B.args[2]) == (Base.OneTo(∞),Base.OneTo(∞))
61-
@test axes(B) == (Base.OneTo(∞),Base.OneTo(∞))
59+
@test axes(B.args[2].args[1]) == (oneto(∞),oneto(∞))
60+
@test axes(B.args[2]) == (oneto(∞),oneto(∞))
61+
@test axes(B) == (oneto(∞),oneto(∞))
6262

6363
@test BandedMatrix(view(B,1:10,13:20)) == zeros(10,8)
6464

test/test_ultraspherical.jl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ using ClassicalOrthogonalPolynomials, BandedMatrices, LazyArrays, Test
4040

4141
@testset "Interrelationships" begin
4242
@testset "Chebyshev–Ultrashperical" begin
43-
T = Chebyshev()
43+
T = ChebyshevT()
4444
U = ChebyshevU()
4545
C = Ultraspherical(2)
4646
D = Derivative(axes(T,1))
@@ -56,12 +56,28 @@ using ClassicalOrthogonalPolynomials, BandedMatrices, LazyArrays, Test
5656
S₁ = (C\U)[1:10,1:10]
5757
@test S₁ isa BandedMatrix{Float64}
5858
@test S₁ == diagm(0 => 1 ./ (1:10), 2=> -(1 ./ (3:10)))
59+
60+
@test (U\C)[1:10,1:10] inv((C\U)[1:10,1:10])
61+
@test (T\C)[1:10,1:10] inv((C\T)[1:10,1:10])
62+
@test bandwidths(U\C) == bandwidths(T\C) == (0,∞)
63+
@test colsupport(U\C,5) == colsupport(T\C,5) == 1:5
64+
@test rowsupport(U\C,5) == rowsupport(T\C,5) == 5:
5965
end
6066
@testset "Legendre" begin
6167
@test Ultraspherical(0.5) \ (UltrasphericalWeight(0.0) .* Ultraspherical(0.5)) == Eye(∞)
6268
@test Legendre() \ (UltrasphericalWeight(0.0) .* Ultraspherical(0.5)) == Eye(∞)
69+
@test (Legendre() \ Ultraspherical(1.5))[1:10,1:10] inv(Ultraspherical(1.5) \ Legendre())[1:10,1:10]
6370
end
6471
end
72+
73+
@testset "Conversion" begin
74+
R = Ultraspherical(3.5) \ Ultraspherical(0.5)
75+
c = [[1,2,3,4,5]; zeros(∞)]
76+
@test Ultraspherical(3.5)[0.1,:]' * (R * c) Ultraspherical(0.5)[0.1,:]' * c
77+
Ri = Ultraspherical(0.5) \ Ultraspherical(3.5)
78+
@test Ri[1:10,1:10] inv(R[1:10,1:10])
79+
@test Ultraspherical(0.5)[0.1,:]' * (Ri * c) Ultraspherical(3.5)[0.1,:]' * c
80+
end
6581
end
6682

6783
@testset "test on functions" begin

0 commit comments

Comments
 (0)