views:

101

answers:

1

I want to write a program in Java that uses fast Fourier transformation. The program reads data every 5 milliseconds seconds from sensors and is supposed to do something with the data every 200 milliseconds based on the data from the last five seconds.

Is there a good library in Java that provides a way to do Fourier transformation without recalculating all five seconds every time?

+1  A: 

Hard real time problems are not the proper application of Java. There are too many variables such as Garbage collection and Threads not guaranteed to happen within a given interval to make this possible. If close enough is acceptable it will work. The performance of your software as far as timing will also depend on the OS and hardware you are using and what other programs are also running on that box.

There is a Real Time Java, that does have a special API for the issues I mention above. You do not indicate that you are using that. It is also a different animal in a lot of respects than plain Java.

Romain Hippeau
I need Java because it has to run on Android and the program needs a lot of API calls.
Christian
@Christian - How hard fast are your timings ? It would also help if you put an Android tag to help guide the answers.
Romain Hippeau
+1 @Romain Hippeau: Great answer, and thanks for the heads up on RTJS
bguiz
How fast? As I wrote in the question a reading every five ms with equals 200hz.
Christian
@Christian You do not say what the application is supposed to do, or what it is going to do with these inputs other than calculate a Transform from some waves. All I am trying to say with my answer is that you may not be able to guarantee that you can keep up with your time schedule, How bad would that be ?
Romain Hippeau