JuliaApproximation / SemiclassicalOrthogonalPolynomials.jl

A Julia repository for semiclassical orthogonal polynomials
MIT License
7 stars 3 forks source link

Converting between the same basis #110

Closed DanielVandH closed 2 months ago

DanielVandH commented 2 months ago

https://github.com/JuliaApproximation/SemiclassicalOrthogonalPolynomials.jl/blob/54e43e480dbb512010b1f3d188300549c3870674/src/SemiclassicalOrthogonalPolynomials.jl#L266

Is there a technical reason why we can't just return I here? The SymTridiagonal causes the bandwidth of further multiplications to be increased by 1 on each side for example, if chaining connections where the last connection could just be the identity.

dlfivefifty commented 2 months ago

@TSGut wrote that code

I'd return Eye{T}(∞)

TSGut commented 2 months ago

There is a reason but it's fine to change it as long as you test it well.

The reason is that in multiple contexts jacobimatrix and things using them assume that the data structure is of particular type and this compounds when you have chained multiplications. If you return an object of different type in some situations it will likely mean special casing those functions or overloading them to also work with other types / converting the arrays.

I guess just try returning Eye or I and see if anything breaks. As you saw with inv ApplyArray is very particular about memorylayouts and types.

DanielVandH commented 2 months ago

Think this has now changed in the latest PR, so closing