@@ -288,34 +288,17 @@ function _jacobi_convert_b(a, b) # Jacobi(a, b+1) \ Jacobi(a, b)
288288 end
289289end
290290
291- # TODO : implement ApplyArray(*, A) in LazyArrays.jl, then these can be simplified
292- # the type specification is also because LazyArrays.jl is slow otherwise
293- # getindex and print could be very slow. This needs to be fixed by LazyArrays.jl
294291function _jacobi_convert_a (a, b, k, T) # Jacobi(a+k, b) \ Jacobi(a, b)
295292 j = round (k)
296293 @assert j ≈ k
297294 k = Integer (j)
298- if iszero (k)
299- Eye {T} (∞)
300- elseif isone (k)
301- _jacobi_convert_a (a, b)
302- else
303- list = tuple ([_jacobi_convert_a (a+ j, b) for j in k- 1 : - 1 : 0 ]. .. )
304- ApplyArray {T,2,typeof(*),typeof(list)} (* , list)
305- end
295+ reduce (* , [_jacobi_convert_a (a+ j, b) for j in k- 1 : - 1 : 0 ], init= Eye {T} (∞))
306296end
307297function _jacobi_convert_b (a, b, k, T) # Jacobi(a, b+k) \ Jacobi(a, b)
308298 j = round (k)
309299 @assert j ≈ k
310300 k = Integer (j)
311- if iszero (k)
312- Eye {T} (∞)
313- elseif isone (k)
314- _jacobi_convert_b (a, b)
315- else
316- list = tuple ([_jacobi_convert_b (a, b+ j) for j in k- 1 : - 1 : 0 ]. .. )
317- ApplyArray {T,2,typeof(*),typeof(list)} (* , list)
318- end
301+ reduce (* , [_jacobi_convert_b (a, b+ j) for j in k- 1 : - 1 : 0 ], init= Eye {T} (∞))
319302end
320303
321304function \ (A:: Jacobi , B:: Jacobi )
@@ -331,15 +314,7 @@ function \(A::Jacobi, B::Jacobi)
331314 else
332315 C2 = inv (_jacobi_convert_b (ba, ab, - kb, T))
333316 end
334- if iszero (ka)
335- C2
336- elseif iszero (kb)
337- C1
338- else
339- list = (C1, C2)
340- ApplyArray {T,2,typeof(*),typeof(list)} (* , list)
341- C1 * C2
342- end
317+ C1 * C2
343318 else
344319 inv (B \ A)
345320 end
@@ -355,14 +330,8 @@ function \(w_A::WeightedJacobi, B::Jacobi)
355330 w_A \ (JacobiWeight (zero (a),zero (b)) .* B)
356331end
357332
358- function \ (A:: AbstractJacobi , w_B:: WeightedJacobi )
359- Ã = Jacobi (A)
360- (A \ Ã) * (Ã \ w_B)
361- end
362- function \ (w_A:: WeightedJacobi , B:: AbstractJacobi )
363- B̃ = Jacobi (B)
364- (w_A \ B̃) * (B̃ \ B)
365- end
333+ \ (A:: AbstractJacobi , w_B:: WeightedJacobi ) = Jacobi (A) \ w_B
334+ \ (w_A:: WeightedJacobi , B:: AbstractJacobi ) = w_A \ Jacobi (B)
366335
367336
368337function broadcastbasis (:: typeof (+ ), w_A:: WeightedJacobi , w_B:: WeightedJacobi )
0 commit comments