Skip to content

Commit 8c1783a

Browse files
committed
dot tests
1 parent 495b5ed commit 8c1783a

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/classical/legendre.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ singularities(d::Inclusion{T,<:Interval}) where T = LegendreWeight{T}()[affine(d
4040
singularities(::AbstractFillLayout, P) = LegendreWeight{eltype(P)}()
4141

4242
_basis(::LegendreWeight{T}) where T = Legendre{T}()
43+
_basis(v::SubQuasiArray) = view(_basis(parent(v)), parentindices(v)[1], :)
4344

4445
struct Legendre{T} <: AbstractJacobi{T} end
4546
Legendre() = Legendre{Float64}()
@@ -171,7 +172,7 @@ _sum(p::SubQuasiArray{T,1,Legendre{T},<:Tuple{Inclusion,Int}}, ::Colon) where T
171172
# dot
172173
###
173174

174-
_dot(::Inclusion{<:Any,<:ChebyshevInterval}, a, b) = __dot(MemoryLayout(a), MemoryLayout(b), a, b)
175+
_dot(::Inclusion{<:Any,<:AbstractInterval}, a, b) = __dot(MemoryLayout(a), MemoryLayout(b), a, b)
175176
function __dot(::ExpansionLayout, ::ExpansionLayout, a, b)
176177
P,c = basis(a),coefficients(a)
177178
Q,d = basis(b),coefficients(b)

test/runtests.jl

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,13 @@ include("test_roots.jl")
5959
end
6060

6161
@testset "basis" begin
62-
x = Inclusion(ChebyshevInterval())
63-
@test sum(x) == 2.0
64-
sum(x .^ 2)
65-
sum(exp.(x))
66-
@test dot(x, x) 2/3
67-
dot(x.^2, x.^2)
68-
dot(exp.(x), x.^2)
69-
dot(x, exp.(x)) dot(exp.(x), x)
70-
71-
Inclusion(1 .. 2)
72-
62+
for x in (Inclusion(ChebyshevInterval()), Inclusion(1 .. 2))
63+
@test sum(x) == last(x)-first(x)
64+
# sum(x .^ 2)
65+
# sum(exp.(x))
66+
@test dot(x, x) sum(expand(x .^2))
67+
@test dot(x.^2, x.^2) sum(expand(x .^4))
68+
@test dot(exp.(x), x.^2) sum(expand(x .^2 .* exp.(x)))
69+
@test dot(x, exp.(x)) dot(exp.(x), x)
70+
end
7371
end

0 commit comments

Comments
 (0)