@@ -10,7 +10,8 @@ using ContinuumArrays, QuasiArrays, LazyArrays, FillArrays, BandedMatrices, Bloc
10
10
import Base: @_inline_meta , axes, getindex, unsafe_getindex, convert, prod, * , / , \ , + , - ,
11
11
IndexStyle, IndexLinear, == , OneTo, tail, similar, copyto!, copy, setindex,
12
12
first, last, Slice, size, length, axes, IdentityUnitRange, sum, _sum, cumsum,
13
- to_indices, _maybetail, tail, getproperty, inv, show, isapprox, summary
13
+ to_indices, _maybetail, tail, getproperty, inv, show, isapprox, summary,
14
+ findall, searchsortedfirst
14
15
import Base. Broadcast: materialize, BroadcastStyle, broadcasted, Broadcasted
15
16
import LazyArrays: MemoryLayout, Applied, ApplyStyle, flatten, _flatten, adjointlayout,
16
17
sub_materialize, arguments, sub_paddeddata, paddeddata, PaddedLayout, resizedata!, LazyVector, ApplyLayout, call,
@@ -34,10 +35,10 @@ import QuasiArrays: cardinality, checkindex, QuasiAdjoint, QuasiTranspose, Inclu
34
35
import InfiniteArrays: OneToInf, InfAxes, Infinity, AbstractInfUnitRange, InfiniteCardinal, InfRanges
35
36
import InfiniteLinearAlgebra: chop!, chop, choplength, compatible_resize!
36
37
import ContinuumArrays: Basis, Weight, basis, @simplify , Identity, AbstractAffineQuasiVector, ProjectionFactorization,
37
- inbounds_getindex, grid, plotgrid, transform_ldiv, TransformFactorization, QInfAxes, broadcastbasis, ExpansionLayout, basismap,
38
+ inbounds_getindex, grid, plotgrid, _plotgrid, _grid, transform_ldiv, TransformFactorization, QInfAxes, broadcastbasis, ExpansionLayout, basismap,
38
39
AffineQuasiVector, AffineMap, WeightLayout, AbstractWeightedBasisLayout, WeightedBasisLayout, WeightedBasisLayouts, demap, AbstractBasisLayout, BasisLayout,
39
40
checkpoints, weight, unweighted, MappedBasisLayouts, __sum, invmap, plan_ldiv, layout_broadcasted, MappedBasisLayout, SubBasisLayout, _broadcastbasis,
40
- plan_transform, plan_grid_transform
41
+ plan_transform, plan_grid_transform, MAX_PLOT_POINTS
41
42
import FastTransforms: Λ, forwardrecurrence, forwardrecurrence!, _forwardrecurrence!, clenshaw, clenshaw!,
42
43
_forwardrecurrence_next, _clenshaw_next, check_clenshaw_recurrences, ChebyshevGrid, chebyshevpoints, Plan
43
44
@@ -47,13 +48,14 @@ import BlockArrays: blockedrange, _BlockedUnitRange, unblock, _BlockArray, block
47
48
import BandedMatrices: bandwidths
48
49
49
50
export OrthogonalPolynomial, Normalized, orthonormalpolynomial, LanczosPolynomial,
50
- Hermite, Jacobi, Legendre, Chebyshev, ChebyshevT, ChebyshevU, ChebyshevInterval, Ultraspherical, Fourier, Laguerre,
51
+ Hermite, Jacobi, Legendre, Chebyshev, ChebyshevT, ChebyshevU, ChebyshevInterval, Ultraspherical, Fourier, Laurent, Laguerre,
51
52
HermiteWeight, JacobiWeight, ChebyshevWeight, ChebyshevGrid, ChebyshevTWeight, ChebyshevUWeight, UltrasphericalWeight, LegendreWeight, LaguerreWeight,
52
53
WeightedUltraspherical, WeightedChebyshev, WeightedChebyshevT, WeightedChebyshevU, WeightedJacobi,
53
54
∞, Derivative, .. , Inclusion,
54
55
chebyshevt, chebyshevu, legendre, jacobi, ultraspherical,
55
56
legendrep, jacobip, ultrasphericalc, laguerrel,hermiteh, normalizedjacobip,
56
- jacobimatrix, jacobiweight, legendreweight, chebyshevtweight, chebyshevuweight, Weighted, PiecewiseInterlace, plan_transform
57
+ jacobimatrix, jacobiweight, legendreweight, chebyshevtweight, chebyshevuweight, Weighted, PiecewiseInterlace, plan_transform,
58
+ expand, transform
57
59
58
60
59
61
import Base: oneto
@@ -111,7 +113,6 @@ copy(L::Ldiv{MappedOPLayout,Lay}) where Lay<:MappedBasisLayouts = copy(Ldiv{Mapp
111
113
112
114
# OPs are immutable
113
115
copy (a:: OrthogonalPolynomial ) = a
114
- copy (a:: SubQuasiArray{<:Any,N,<:OrthogonalPolynomial} ) where N = a
115
116
116
117
"""
117
118
jacobimatrix(P)
@@ -245,18 +246,10 @@ _tritrunc(X, n) = _tritrunc(MemoryLayout(X), X, n)
245
246
jacobimatrix (V:: SubQuasiArray{<:Any,2,<:Any,<:Tuple{Inclusion,OneTo}} ) =
246
247
_tritrunc (jacobimatrix (parent (V)), maximum (parentindices (V)[2 ]))
247
248
248
- grid (P:: SubQuasiArray{<:Any,2,<:OrthogonalPolynomial,<:Tuple{Inclusion,OneTo}} ) =
249
- eigvals (symtridiagonalize (jacobimatrix (P)))
250
-
251
- function grid (Pn:: SubQuasiArray{<:Any,2,<:OrthogonalPolynomial,<:Tuple{Inclusion,Any}} )
252
- kr,jr = parentindices (Pn)
253
- grid (parent (Pn)[:,oneto (maximum (jr))])
254
- end
255
-
256
- function plotgrid (Pn:: SubQuasiArray{T,2,<:OrthogonalPolynomial,<:Tuple{Inclusion,Any}} ) where T
257
- kr,jr = parentindices (Pn)
258
- grid (parent (Pn)[:,oneto (40 maximum (jr))])
259
- end
249
+ _grid (:: AbstractOPLayout , P, n:: Integer ) = eigvals (symtridiagonalize (jacobimatrix (P[:,OneTo (n)])))
250
+ _grid (:: MappedOPLayout , P, n:: Integer ) = _grid (MappedBasisLayout (), P, n)
251
+ _plotgrid (:: AbstractOPLayout , P, n:: Integer ) = grid (P, min (40 n, MAX_PLOT_POINTS))
252
+ _plotgrid (:: MappedOPLayout , P, n:: Integer ) = _plotgrid (MappedBasisLayout (), P, n)
260
253
261
254
function golubwelsch (X)
262
255
D, V = eigen (symtridiagonalize (X)) # Eigenvalue decomposition
@@ -324,16 +317,16 @@ end
324
317
* (A:: AbstractMatrix , P:: MulPlan ) = MulPlan (A* P. matrix, P. dims)
325
318
326
319
327
- function plan_grid_transform (Q:: Normalized , arr, dims= 1 : ndims (arr))
328
- L = Q[:,OneTo (size (arr, 1 ) )]
320
+ function plan_grid_transform (Q:: Normalized , szs :: NTuple{N,Int} , dims= 1 : N) where N
321
+ L = Q[:,OneTo (szs[ 1 ] )]
329
322
x,w = golubwelsch (L)
330
323
x, MulPlan (L[x,:]' * Diagonal (w), dims)
331
324
end
332
325
333
- function plan_grid_transform (P:: OrthogonalPolynomial , arr, dims... )
326
+ function plan_grid_transform (P:: OrthogonalPolynomial , szs :: NTuple{N,Int} , dims= 1 : N) where N
334
327
Q = Normalized (P)
335
- x, A = plan_grid_transform (Q, arr , dims... )
336
- n = size (arr, 1 )
328
+ x, A = plan_grid_transform (Q, szs , dims... )
329
+ n = szs[ 1 ]
337
330
D = (P \ Q)[1 : n, 1 : n]
338
331
x, D * A
339
332
end
@@ -381,6 +374,6 @@ include("classical/ultraspherical.jl")
381
374
include (" classical/laguerre.jl" )
382
375
include (" classical/fourier.jl" )
383
376
include (" stieltjes.jl" )
384
-
377
+ include ( " roots.jl " )
385
378
386
379
end # module
0 commit comments