Open jagot opened 1 year ago
For reference, A'B
is implemented as basis_overlap(A,B)
in https://github.com/JuliaApproximation/CompactBases.jl/pull/63 and looks like this in action: https://juliaapproximation.github.io/CompactBases.jl/previews/PR63/basis_transforms/
Say
A isa Basis
andB isa Basis
, whereaxes(A,1) != axes(B,1)
, then we get the following error:However, if I have a function $f$ that is expanded over the basis
A
, $|f\rangle = \sum_i c_i|a_i\rangle$, and I want to project it onto the basisB
, $|f\rangle = \sum_j d_i|b_j\rangle$, then the above basis overlap is precisely the one I need, since $d_j = \sum_i c_i \langle b_j|a_i\rangle$, or equivalently $\mathbf{d}=A^HB\mathbf{c}$.To me it is unimportant that the axes are different, i.e. I think it is up to the user to make sure that the end result makes sense (e.g. projecting onto a "larger" basis, or maybe I am interested in the subspace, etc).
I can of course override this on a case-by-case basis, but it would be convenient if this just worked, and the only thing you'd need to provide is the calculation of basis function overlaps $\langle b_j|a_i\rangle$. Then it would be very easy to transform between e.g. B-splines and finite-elements or -differences.
What do you think?
EDIT: It seems it will be difficult to work around this on a case-by-case basis, since I cannot circumvent the dimension check easily: