One final thing that I would like to mention is that this implementation that we just did, direct Fourier transform implementation is very simple, very basic and also slow. It's not fit for purpose if you really want to do something in production environment. It was just shown to you so that you can get a good understanding of what the Fourier Transform is and how we can use it to kind of decompose signals. If you are really interested in having a fast implementation of DFT, there is something called fast Fourier transform, which is a modification of the DFT algorithm, and it is really fast compared to DFT. Now DFT, the competition of complexity of DFT is quadratic time. So it's O n2, it's quadratic time. FFT for comparison is quasi-linear time. So this will be O of nlogn and FFT does this by exploiting asymmetry in the Fourier transformation. So if you have Xk, I'll just give you the rough idea of how it works. And that's your sum over angles from 0 to n-1. Write xn e to the -2 pi ink over n. You know that's your standard discrete for your transformation. What F50 does, is it kind of breaks down this computation into two separate computations. One for the even indices of x and the other for the odd indices. So you end up with a computation that looks like this. You can do Xk equals sum N from 0 to n-1. And this is x 2n. So this is for the, we're breaking it into even and odd indices. E to the minus 2 pi i 2nk right over n + sum of. I made a mistake here, this has to be n over 2 because we are kind of splitting the dataset in two. N equal 0, n over 2 minus 1 of X and this time, we are dealing with the other indexes, 2n +1 e-2 pie i 2n +1, k over it, okay? And then what happens is that this + 1. You can take to the front so you get something like xk is the sum of angles from 0 and over 2- 1 x to ne, -2 pi i, 2nk over n + and you'll get this e to the -2 pi ik over n here. And then the sum n goes from 0 to n over 2 minus 1, and here you are left with x of 2n plus 1, e to the minus 2 pi i 2nk over n. And then you see that and this guy here, by the way this guy is called twiddle factor. And then what happen is if you write this down for x of k+n over 2 right? You'll essentially get the exact same expression like this one, the only difference will be the sign in front of the twiddle factor. This will be a minus here. Otherwise this would be identical, this would be identical, right? And because xk and xk + n over 2 differ only by the sign of this to the factor, we can recursively keep reducing the problem to halves and then the algorithm performs with this complexity. I don't really want to get into details but if you're interested, just look it up. Go to Wikipedia or actually look up the original paper on Fast Fourier Transform. And maybe as a good exercise see if you can implement it in systemML. Right. The final thing I would like to cover, and this will be the end of my Fourier transforms introduction session, is duplications. You know, you saw how you can decompose signals, you saw how you can implement Fourier transform and discrete Fourier transform from scratch. How you can use it in SystemML to process big data sets and so on, and so on, but what's the purpose? Well, there are many different ways of actually using Fourier transform in signal processing and analytics. Probably the most simple way is to use it for feature extraction, right? Because here you can see a bunch of signals for example. And what you can do is you can apply the Fourier transform. This time the box is open because you know so much about it already. And you can generate your spectrograms, you can generate your magnitudes. You can get your phase shift and so on, and so on. And because these guys here, they have the same dimensions, you can treat them as a feature vector, right? You can get any signal, arbitrary long, you don't care about this, use a Fourier transform, get the distribution of energy of the frequencies, and then use this as a feature vector. And then maybe, I don't know, apply something like k-means, see how close these signals are to each other and maybe classify them. Or maybe you can feed these two in your network and digital network distinguish between different types of music. Maybe a classical music when a piano is playing compared to pop music or whatever. So this is probably the most obvious use case for Fourier transformations. Virtually, you can take any signal. It doesn't have to be an audio signal, it can be a sensory signal, it can be anything. You can decompose it to signals, get this almost like a fingerprint of the frequencies and their magnitudes. And then feed this to a typical machine learning classifier and see what we can do with it. Okay, thanks for watching.