#6 Disabled concurrency in FloatFFT_2D for size >= 64K

open
nobody
None
5
2012-02-16
2012-02-16
Laurent Bourgès
No

This is related to the FloatFFT_2D constructor that defines the useThreads variable: rows x columns > java int maximum values (32-bit signed 2,147,483,647)

Here is the trivial fix (convert int to long):

/**
* Creates new instance of FloatFFT_2D.
*
* @param rows number of rows
* @param columns number of columns
*/
public FloatFFT_2D(int rows, int columns) {
if (rows <= 1 || columns <= 1) {
throw new IllegalArgumentException("rows and columns must be greater than 1");
}
this.rows = rows;
this.columns = columns;

// fix integer capacity for rows = columns = 65536 !
if (((long)rows * columns) >= ConcurrencyUtils.getThreadsBeginN_2D()) {
this.useThreads = true;
}
...
}

Could you check and fix that bug anywhere it could happen (xxxFFT_2D, xxxFFT_3D ...) ?

Discussion