Is Discrete FFT possible with flux?

Is implementing FFT like described in this article possible in Flux language? I suppose the answer would be yes so long as flux supports recursion? Thanks.

Hello @generic_coder,
I think so?
You might be interested in utilizing reduce(). Do you have any interest in contributing a Flux contrib package? If so, we’d love to help!
I can recommend these resources to get you started:

This is a PR with median absolute deviation and linear regression using reduce to offer more suggestions.

Hello and thank you for your response. I might be, depending on how feasible it is. Currently I need FFT done on data but extracting from and writing to InfluxDB seem to be where the biggest performance penalties are incurred. Thus if I can perform FFT without ever have to move the data from/to Influx, this would be ideal.

Currently after some investigation, I am not sure it will be possible with Flux. These are the challenges:

  1. How can I group data into X number of contiguous records? I.e. grab all data from t1 to t2, window by every X = 1024 records (I know you can group by every “time unit” but in my specific case I need to specify a 1024 FFT).
  2. Assuming I can group records into 1024 sized groups, how can I ensure the time delta between any two records does not exceed a threshold?

I’m beginning to wonder, if flux cannot do this, can flux call upon the power of lower level optomized languages like C or Fortran? Thanks.

1 Like

Hello @generic_coder,
I’m looking into it right now, and I’ll get back to you asap. I also want to recommend that you join the Slack Workspace and join the #flux channel to get more assistance. We’d love to help you contribute this. Please tag me Anais and Michael Hall and Nathaniel cook.

This seems like an interesting problem and I’d like to see if we can get the requirements into an issue. We would like for Flux to be able to have this kind of flexibility and it would mostly be about defining how the function works and what output is required. Do you think you could make a Flux issue that also shows what your expected input and output might be?

There’s also a contrib function that exists that might be interesting, but it presently does not have a way to conform to your specific requirements. It’s very similar to reduce but operates on arrays instead of individual rows.