# How to implement discretized CWT with FFT?

I tried to make circular convolution (correlation actually because it is easier to understand for me) look like the Continuous Wavelet Transform (CWT) but got stuck because the conjugation was on the wavelet and the sign was different too (resembled $x[m](y[m-n])^*$ instead of $x[m] y[n-m]$).

I have a signal sampled from my microphone, and I have numpy and scipy. But since I can't get the indices to play nice I don't know how to implement cwt using fft.

Realized that the (unitary-/ortho-)DFT is basically a list of inner products $$F(x)_k=\langle x(\_), |n|^{-1/2}\exp(\frac{i\cdot 2\cdot \pi \cdot k \cdot \_}{n})\rangle_k=\langle x(\_), f_k(\_)\rangle_k\\ F^{-1}(X)_k=\langle X(\_), f^*_k(\_)\rangle_k$$ since the second argument gets conjugated in the complex inner product of $\ell^2$.

In a similar fashion I guess a discretized CWT (DCWT) would be something like $$\Phi(x)_{(a,b)}=\langle x(\_), |a|^{-1/2} \phi(\frac{\_-b}{a}))\rangle_{(a,b)}=\langle x(\_), \phi_{(a,b)}(\_)\rangle_{(a,b)}$$ (haven't found a formula for the inverse that is symmetric like the dft yet so the normalization constant might be wrong).

Convolution would be something like $$(x\ast y)_{k} = \langle x(\_) , y^*(-\_+k)\rangle_{k}$$ (conjugation of conjugation should be identity. Should it be divided by $n$?)

Cross-correlation would be something like (should it be divided by $n$?) $$(x\star y)_k = \langle x^*(\_), y^*(\_+k)\rangle_k$$ wolfram also says (I think. Should it be divided by $n$?) $$(x\star y)_k = (x^*(-\_)\ast y(\_))_k = \langle x^*(-\_) , y^*(-\_+k)\rangle_{k}$$

I think the convolution theorem says $$[F\cdot F](x,y)_k=F(x)_{k}\cdot F(y)_{k}\\ (x\ast y)_k = F^{-1}([F\cdot F](x,y)_{\_})_k$$ (should it be multiplied by $|n|^{1/2}$ or $|n|^{3/2}$ when using unitary dft? should it be as is or multiplied by $n$ when using the default dft?)

I think I want the b (or maybe some fraction of a and b) of the DCWT to be the k of the convolution/correlation somehow? Perhaps $$y_a(t)=|a|^{-1/2}\phi^*(-a^{-1}\cdot t)\\ \Phi(x)_{(a,b)}=(x\ast y_a)_b$$

To be honest, if I want to use a CWT, I'll use the toolbox Matlab provides.

I have every confidence that I could code a CWT, but an efficient, debugged, and tested set of routines is not an interest.

There are a number of open source wavelet codes that a Google search will return, such as

https://stackoverflow.com/questions/9606458/looking-for-a-good-c-c-wavelet-library-for-signal-processing

so there is code available that you can use and/or modify or just get ideas from.

Also, you haven't posted what you have so far produced, code or equations. No one can offer any concrete suggestions or advice given your description.

Yes it is series of inner products. Each new one shrunk / grown a bit. You can calculate these with circulant matrix multiplication if you are careful to pad your data with long enough string of 0. The circulant matrices will each have a factorization (fft) with same transform matrices but unique diagonal matrices in the middle. So it allows for fast implementation