本文整理汇总了Java中org.jtransforms.utils.CommonUtils类的典型用法代码示例。如果您正苦于以下问题:Java CommonUtils类的具体用法?Java CommonUtils怎么用?Java CommonUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CommonUtils类属于org.jtransforms.utils包,在下文中一共展示了CommonUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FloatFFT_2D
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Creates new instance of FloatFFT_2D.
*
* @param rows number of rows
* @param columns number of columns
*/
public FloatFFT_2D(long rows, long columns)
{
if (rows <= 1 || columns <= 1) {
throw new IllegalArgumentException("rows and columns must be greater than 1");
}
this.rows = (int) rows;
this.columns = (int) columns;
this.rowsl = rows;
this.columnsl = columns;
if (rows * columns >= CommonUtils.getThreadsBeginN_2D()) {
this.useThreads = true;
}
if (CommonUtils.isPowerOf2(rows) && CommonUtils.isPowerOf2(columns)) {
isPowerOfTwo = true;
}
CommonUtils.setUseLargeArrays(2 * rows * columns > LargeArray.getMaxSizeOf32bitArray());
fftRows = new FloatFFT_1D(rows);
if (rows == columns) {
fftColumns = fftRows;
} else {
fftColumns = new FloatFFT_1D(columns);
}
}
示例2: DoubleFFT_2D
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Creates new instance of DoubleFFT_2D.
*
* @param rows
* number of rows
* @param columns
* number of columns
*/
public DoubleFFT_2D(long rows, long columns)
{
if (rows <= 1 || columns <= 1) {
throw new IllegalArgumentException("rows and columns must be greater than 1");
}
this.rows = (int) rows;
this.columns = (int) columns;
this.rowsl = rows;
this.columnsl = columns;
if (rows * columns >= CommonUtils.getThreadsBeginN_2D()) {
this.useThreads = true;
}
if (CommonUtils.isPowerOf2(rows) && CommonUtils.isPowerOf2(columns)) {
isPowerOfTwo = true;
}
CommonUtils.setUseLargeArrays(2 * rows * columns > LargeArray.getMaxSizeOf32bitArray());
fftRows = new DoubleFFT_1D(rows);
if (rows == columns) {
fftColumns = fftRows;
} else {
fftColumns = new DoubleFFT_1D(columns);
}
}
示例3: complexForward
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Computes 1D forward DFT of complex data leaving the result in
* <code>a</code>. Complex number is stored as two double values in
* sequence: the real and imaginary part, i.e. the size of the input array
* must be greater or equal 2*n. The physical layout of the input data has
* to be as follows:<br>
*
* <pre>
* a[offa+2*k] = Re[k],
* a[offa+2*k+1] = Im[k], 0<=k<n
* </pre>
*
* @param a data to transform
* @param offa index of the first element in array <code>a</code>
*/
public void complexForward(double[] a, int offa)
{
if (useLargeArrays) {
complexForward(new DoubleLargeArray(a), offa);
} else {
if (n == 1) {
return;
}
switch (plan) {
case SPLIT_RADIX:
CommonUtils.cftbsub(2 * n, a, offa, ip, nw, w);
break;
case MIXED_RADIX:
cfftf(a, offa, -1);
break;
case BLUESTEIN:
bluestein_complex(a, offa, -1);
break;
}
}
}
示例4: complexInverse
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Computes 1D inverse DFT of complex data leaving the result in
* <code>a</code>. Complex number is stored as two double values in
* sequence: the real and imaginary part, i.e. the size of the input array
* must be greater or equal 2*n. The physical layout of the input data has
* to be as follows:<br>
*
* <pre>
* a[offa+2*k] = Re[k],
* a[offa+2*k+1] = Im[k], 0<=k<n
* </pre>
*
* @param a data to transform
* @param offa index of the first element in array <code>a</code>
* @param scale if true then scaling is performed
*/
public void complexInverse(double[] a, int offa, boolean scale)
{
if (useLargeArrays) {
complexInverse(new DoubleLargeArray(a), offa, scale);
} else {
if (n == 1) {
return;
}
switch (plan) {
case SPLIT_RADIX:
CommonUtils.cftfsub(2 * n, a, offa, ip, nw, w);
break;
case MIXED_RADIX:
cfftf(a, offa, +1);
break;
case BLUESTEIN:
bluestein_complex(a, offa, 1);
break;
}
if (scale) {
CommonUtils.scale(n, 1.0 / (double) n, a, offa, true);
}
}
}
示例5: complexForward
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Computes 1D forward DFT of complex data leaving the result in
* <code>a</code>. Complex number is stored as two float values in
* sequence: the real and imaginary part, i.e. the size of the input array
* must be greater or equal 2*n. The physical layout of the input data has
* to be as follows:<br>
*
* <pre>
* a[offa+2*k] = Re[k],
* a[offa+2*k+1] = Im[k], 0<=k<n
* </pre>
*
* @param a data to transform
* @param offa index of the first element in array <code>a</code>
*/
public void complexForward(float[] a, int offa)
{
if (useLargeArrays) {
complexForward(new FloatLargeArray(a), offa);
} else {
if (n == 1) {
return;
}
switch (plan) {
case SPLIT_RADIX:
CommonUtils.cftbsub(2 * n, a, offa, ip, nw, w);
break;
case MIXED_RADIX:
cfftf(a, offa, -1);
break;
case BLUESTEIN:
bluestein_complex(a, offa, -1);
break;
}
}
}
示例6: complexInverse
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Computes 1D inverse DFT of complex data leaving the result in
* <code>a</code>. Complex number is stored as two float values in
* sequence: the real and imaginary part, i.e. the size of the input array
* must be greater or equal 2*n. The physical layout of the input data has
* to be as follows:<br>
*
* <pre>
* a[offa+2*k] = Re[k],
* a[offa+2*k+1] = Im[k], 0<=k<n
* </pre>
*
* @param a data to transform
* @param offa index of the first element in array <code>a</code>
* @param scale if true then scaling is performed
*/
public void complexInverse(float[] a, int offa, boolean scale)
{
if (useLargeArrays) {
complexInverse(new FloatLargeArray(a), offa, scale);
} else {
if (n == 1) {
return;
}
switch (plan) {
case SPLIT_RADIX:
CommonUtils.cftfsub(2 * n, a, offa, ip, nw, w);
break;
case MIXED_RADIX:
cfftf(a, offa, +1);
break;
case BLUESTEIN:
bluestein_complex(a, offa, 1);
break;
}
if (scale) {
CommonUtils.scale(n, 1.0f / (float) n, a, offa, true);
}
}
}
示例7: DoubleDST_2D
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Creates new instance of DoubleDST_2D.
*
* @param rows number of rows
* @param columns number of columns
*/
public DoubleDST_2D(long rows, long columns)
{
if (rows <= 1 || columns <= 1) {
throw new IllegalArgumentException("rows and columns must be greater than 1");
}
this.rows = (int) rows;
this.columns = (int) columns;
this.rowsl = rows;
this.columnsl = columns;
if (rows * columns >= CommonUtils.getThreadsBeginN_2D()) {
useThreads = true;
}
if (CommonUtils.isPowerOf2(rows) && CommonUtils.isPowerOf2(columns)) {
isPowerOfTwo = true;
}
CommonUtils.setUseLargeArrays(rows * columns > LargeArray.getMaxSizeOf32bitArray());
dstRows = new DoubleDST_1D(rows);
if (rows == columns) {
dstColumns = dstRows;
} else {
dstColumns = new DoubleDST_1D(columns);
}
}
示例8: FloatDST_2D
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Creates new instance of FloatDST_2D.
*
* @param rows number of rows
* @param columns number of columns
*/
public FloatDST_2D(long rows, long columns)
{
if (rows <= 1 || columns <= 1) {
throw new IllegalArgumentException("rows and columns must be greater than 1");
}
this.rows = (int) rows;
this.columns = (int) columns;
this.rowsl = rows;
this.columnsl = columns;
if (rows * columns >= CommonUtils.getThreadsBeginN_2D()) {
useThreads = true;
}
if (CommonUtils.isPowerOf2(rows) && CommonUtils.isPowerOf2(columns)) {
isPowerOfTwo = true;
}
CommonUtils.setUseLargeArrays(rows * columns > LargeArray.getMaxSizeOf32bitArray());
dstRows = new FloatDST_1D(rows);
if (rows == columns) {
dstColumns = dstRows;
} else {
dstColumns = new FloatDST_1D(columns);
}
}
示例9: DoubleDCT_2D
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Creates new instance of DoubleDCT_2D.
*
* @param rows number of rows
* @param columns number of columns
*/
public DoubleDCT_2D(long rows, long columns)
{
if (rows <= 1 || columns <= 1) {
throw new IllegalArgumentException("rows and columns must be greater than 1");
}
this.rows = (int) rows;
this.columns = (int) columns;
this.rowsl = rows;
this.columnsl = columns;
if (rows * columns >= CommonUtils.getThreadsBeginN_2D()) {
this.useThreads = true;
}
if (CommonUtils.isPowerOf2(rows) && CommonUtils.isPowerOf2(columns)) {
isPowerOfTwo = true;
}
CommonUtils.setUseLargeArrays(rows * columns > LargeArray.getMaxSizeOf32bitArray());
dctRows = new DoubleDCT_1D(rows);
if (rows == columns) {
dctColumns = dctRows;
} else {
dctColumns = new DoubleDCT_1D(columns);
}
}
示例10: FloatDCT_2D
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Creates new instance of FloatDCT_2D.
*
* @param rows number of rows
* @param columns number of columns
*/
public FloatDCT_2D(long rows, long columns)
{
if (rows <= 1 || columns <= 1) {
throw new IllegalArgumentException("rows and columns must be greater than 1");
}
this.rows = (int) rows;
this.columns = (int) columns;
this.rowsl = rows;
this.columnsl = columns;
if (rows * columns >= CommonUtils.getThreadsBeginN_2D()) {
this.useThreads = true;
}
if (CommonUtils.isPowerOf2(rows) && CommonUtils.isPowerOf2(columns)) {
isPowerOfTwo = true;
}
CommonUtils.setUseLargeArrays(rows * columns > LargeArray.getMaxSizeOf32bitArray());
dctRows = new FloatDCT_1D(rows);
if (rows == columns) {
dctColumns = dctRows;
} else {
dctColumns = new FloatDCT_1D(columns);
}
}
示例11: DoubleDHT_2D
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Creates new instance of DoubleDHT_2D.
*
* @param rows number of rows
* @param columns number of columns
*/
public DoubleDHT_2D(long rows, long columns)
{
if (rows <= 1 || columns <= 1) {
throw new IllegalArgumentException("rows and columns must be greater than 1");
}
this.rows = (int) rows;
this.columns = (int) columns;
this.rowsl = rows;
this.columnsl = columns;
if (rows * columns >= CommonUtils.getThreadsBeginN_2D()) {
this.useThreads = true;
}
if (CommonUtils.isPowerOf2(rows) && CommonUtils.isPowerOf2(columns)) {
isPowerOfTwo = true;
}
CommonUtils.setUseLargeArrays(rows * columns > LargeArray.getMaxSizeOf32bitArray());
dhtRows = new DoubleDHT_1D(rows);
if (rows == columns) {
dhtColumns = dhtRows;
} else {
dhtColumns = new DoubleDHT_1D(columns);
}
}
示例12: inverse
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Computes 1D real, inverse DHT leaving the result in <code>a</code>.
*
* @param a data to transform
* @param offa index of the first element in array <code>a</code>
* @param scale if true then scaling is performed
*/
public void inverse(final DoubleLargeArray a, final long offa, boolean scale)
{
if (n == 1) {
return;
}
if (!useLargeArrays) {
if (!a.isLarge() && !a.isConstant() && offa < Integer.MAX_VALUE) {
inverse(a.getData(), (int) offa, scale);
} else {
throw new IllegalArgumentException("The data array is too big.");
}
} else {
forward(a, offa);
if (scale) {
CommonUtils.scale(n, 1.0 / n, a, offa, false);
}
}
}
示例13: inverse
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Computes 1D real, inverse DHT leaving the result in <code>a</code>.
*
* @param a
* data to transform
* @param offa
* index of the first element in array <code>a</code>
* @param scale
* if true then scaling is performed
*/
public void inverse(final FloatLargeArray a, final long offa, boolean scale)
{
if (n == 1)
return;
if (!useLargeArrays) {
if (!a.isLarge() && !a.isConstant() && offa < Integer.MAX_VALUE) {
inverse(a.getData(), (int) offa, scale);
} else {
throw new IllegalArgumentException("The data array is too big.");
}
} else {
forward(a, offa);
if (scale) {
CommonUtils.scale(n, 1.0f / n, a, offa, false);
}
}
}
示例14: FloatDHT_2D
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Creates new instance of FloatDHT_2D.
*
* @param rows number of rows
* @param columns number of columns
*/
public FloatDHT_2D(long rows, long columns)
{
if (rows <= 1 || columns <= 1) {
throw new IllegalArgumentException("rows and columns must be greater than 1");
}
this.rows = (int) rows;
this.columns = (int) columns;
this.rowsl = rows;
this.columnsl = columns;
if (rows * columns >= CommonUtils.getThreadsBeginN_2D()) {
this.useThreads = true;
}
if (CommonUtils.isPowerOf2(rows) && CommonUtils.isPowerOf2(columns)) {
isPowerOfTwo = true;
}
CommonUtils.setUseLargeArrays(rows * columns > LargeArray.getMaxSizeOf32bitArray());
dhtRows = new FloatDHT_1D(rows);
if (rows == columns) {
dhtColumns = dhtRows;
} else {
dhtColumns = new FloatDHT_1D(columns);
}
}
示例15: DoubleFFT_3DTest
import org.jtransforms.utils.CommonUtils; //导入依赖的package包/类
/**
* Creates a new instance of this test.
*
* @param numSlices
* number of slices
* @param numRows
* number of rows
* @param numColumns
* number of columns
* @param numThreads
* the number of threads to be used
* @param seed
* the seed of the random generator
*/
public DoubleFFT_3DTest(final int numSlices, final int numRows,
final int numColumns, final int numThreads, final long seed)
{
this.numSlices = numSlices;
this.numRows = numRows;
this.numCols = numColumns;
LargeArray.setMaxSizeOf32bitArray(1);
this.fft = new DoubleFFT_3D(numSlices, numRows, numColumns);
this.xfft = new DoubleFFT_1D(numSlices);
this.sfft = new DoubleFFT_2D(numRows, numColumns);
this.random = new Random(seed);
ConcurrencyUtils.setNumberOfThreads(numThreads);
CommonUtils.setThreadsBeginN_3D(4);
this.numThreads = ConcurrencyUtils.getNumberOfThreads();
}