I know that $e^{ik\cdot x}$ are not elements of $L^2$. But I believe this is often used in quantum mechanics, and wondered if there is some justification for it.
For example, I have seen the trace of an operator $A$ on $L^2(\mathbb R^d;\mathbb C)$ defined by $$\text{Tr}(A)=\iint A\left(e^{ik\cdot x}\right)e^{-ik\cdot x}\;{\rm d}k\,{\rm d}x.$$
Can we view this orthonormal basis as a limit, or in some weak sense?