I'm working on a similar problem of that raised by Aman in Inner product of quantum states
Concerning the use of Swap Test for calculating the difference of two vectors. An example of the original Lloyd formula is given in Quantum machine learning for data scientists.
And I got stuck at the same point, i.e. what mathematically means the inner product between the two qubits $\psi$ and $\phi$, which have different size. The explanation in the paper (eq. 133) which says
$$\langle \phi|\psi\rangle = \frac{1}{\sqrt{2Z}}(|a||a\rangle - |b||b\rangle)$$
looks incorrect because it equals an inner product (scalar value) with a qubit! Or am I missing something?
The suggestion of composing $\phi$ with tensor products of the identity matrices for matching $\psi$ and $\phi$ sizes looks a math trick because such composition is not an allowed quantum operation (identity matrix I should be supposed to be a qubit, and it's not of course). I share Aman's doubts on the demonstration of (132) i.e. $$|a-b|^2=2Z|\langle\phi|\psi\rangle|^2.$$