@@ -34,7 +34,7 @@ function orthonormalpolynomials(μ0,α::Vector,β::Vector,d)
34
34
n= length (α)+ 1
35
35
36
36
p= Array (Fun{Chebyshev,Float64},n)
37
- p[1 ] = Fun ([μ0],d )
37
+ p[1 ] = Fun (d, [μ0])
38
38
p[2 ] = multiplybyx (p[1 ])./ β[1 ] - p[1 ]. * α[1 ]. / β[1 ]
39
39
for k = 3 : n
40
40
p[k] = multiplybyx (p[k- 1 ])./ β[k- 1 ] - p[k- 1 ]. * α[k- 1 ]. / β[k- 1 ] - p[k- 2 ]. * β[k- 2 ]. / β[k- 1 ]
71
71
72
72
# # Ensembles
73
73
74
- type InvariantEnsemble{D<: Interval }
74
+ type InvariantEnsemble{D}
75
75
basis:: Array{Float64,2} # the m x n array of the first n weighted OPs evaluated at m Chebyshev points
76
76
domain:: D # the sub domain of the real line
77
+ InvariantEnsemble (b,d) = new (b,d)
77
78
end
78
79
79
- InvariantEnsemble (basis,d:: Vector )= InvariantEnsemble (basis,Interval (d))
80
+ InvariantEnsemble (basis:: Matrix ,d:: Domain ) =
81
+ InvariantEnsemble {typeof(d)} (basis,d)
82
+
83
+ InvariantEnsemble (basis:: Matrix ,d:: Vector ) =
84
+ InvariantEnsemble (basis,Interval (d[1 ],d[2 ]))
85
+
86
+ InvariantEnsemble (basis,d:: Vector ) =
87
+ InvariantEnsemble (basis,Interval (d[1 ],d[2 ]))
80
88
81
89
82
90
# # n, where the invariant ensemble is n x n
115
123
function adaptiveie (w,μ0,α,β,d)
116
124
for logn = 4 : 20
117
125
m= 2 ^ logn + 1
118
- pts= points (Interval (d),m)
126
+ pts= points (Interval (d[ 1 ],d[ 2 ] ),m)
119
127
pv= orthonormalpolynomialsvalues (μ0,α,β,pts)
120
128
121
129
wv= w (pts)
@@ -127,7 +135,7 @@ function adaptiveie(w,μ0,α,β,d)
127
135
128
136
m= length (chop! (cfs,200 * eps ()))
129
137
130
- pts= points (Interval (d),m)
138
+ pts= points (Interval (d[ 1 ],d[ 2 ] ),m)
131
139
pv= orthonormalpolynomialsvalues (μ0,α,β,pts)
132
140
wv= w (pts)
133
141
190
198
191
199
# # Construct the invariant ensemble kernel K_n(x,x)
192
200
iekernel (q:: Array{Float64,2} ,d)= iekernel (q,d,plan_chebyshevtransform (q[:,1 ]))
193
- function iekernel (q:: Array{Float64,2} ,d,plan:: Function )
201
+ function iekernel (q:: Array{Float64,2} ,d,plan)
194
202
n= size (q)[1 ]
195
203
m= size (q)[2 ]
196
204
ret= zeros (n)
@@ -200,11 +208,11 @@ function iekernel(q::Array{Float64,2},d,plan::Function)
200
208
end
201
209
end
202
210
203
- Fun (chebyshevtransform (ret ,plan),d )
211
+ Fun (d ,plan* ret )
204
212
end
205
213
206
214
207
- samplespectra (str:: AbstractString ,n:: Integer ,m:: Integer )= samplespectra (InvariantEnsemble (str,n),m)
215
+ samplespectra (str:: AbstractString ,n:: Integer ,m:: Integer ) = samplespectra (InvariantEnsemble (str,n),m)
208
216
209
217
210
218
# Sample eigenvalues of invariant ensemble, m times
237
245
# # samplespectra is back end for eigvalrand
238
246
samplespectra (q:: Array{Float64,2} ,d)= samplespectra (q,d,plan_chebyshevtransform (q[:,1 ]),chebyshevpoints (size (q,1 )))
239
247
240
- function samplespectra (q:: Array{Float64,2} ,d,plan:: Function ,pts)
248
+ function samplespectra (q:: Array{Float64,2} ,d,plan,pts)
241
249
n = size (q,2 )
242
250
r= Array (Float64,n)
243
251
@@ -247,7 +255,7 @@ function samplespectra(q::Array{Float64,2},d,plan::Function,pts)
247
255
r[k] = samplecdf (normalizedcumsum! (iekernel (q,d,plan). coefficients/ m))
248
256
f= Float64[bary (q[:,j],pts,r[k]) for j = 1 : m]
249
257
r[k] = fromcanonical (d,r[k])
250
- Q= null (f' )
258
+ Q= nullspace (f' )
251
259
q= q* Q
252
260
end
253
261
@@ -273,7 +281,7 @@ function samplespectra{F<:Fun}(p::Array{F})
273
281
r
274
282
else
275
283
f= map (q-> q[r],p)
276
- Q= null (f' )'
284
+ Q= nullspace (f' )'
277
285
[r ;samplespectra (Q* p)]
278
286
end
279
287
end
0 commit comments