當前位置: 首頁>>代碼示例>>Java>>正文


Java CommonUtils.cftx020方法代碼示例

本文整理匯總了Java中org.jtransforms.utils.CommonUtils.cftx020方法的典型用法代碼示例。如果您正苦於以下問題:Java CommonUtils.cftx020方法的具體用法?Java CommonUtils.cftx020怎麽用?Java CommonUtils.cftx020使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jtransforms.utils.CommonUtils的用法示例。


在下文中一共展示了CommonUtils.cftx020方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: realForward

import org.jtransforms.utils.CommonUtils; //導入方法依賴的package包/類
/**
 * Computes 1D forward DFT of real data leaving the result in <code>a</code>
 * . The physical layout of the output data is as follows:<br>
 *  
 * if n is even then
 *  
 * <pre>
 * a[offa+2*k] = Re[k], 0&lt;=k&lt;n/2 
 * a[offa+2*k+1] = Im[k], 0&lt;k&lt;n/2
 * a[offa+1] = Re[n/2]
 * </pre>
 *  
 * if n is odd then
 *  
 * <pre>
 * a[offa+2*k] = Re[k], 0&lt;=k&lt;(n+1)/2 
 * a[offa+2*k+1] = Im[k], 0&lt;k&lt;(n-1)/2 
 * a[offa+1] = Im[(n-1)/2]
 * </pre>
 *  
 * This method computes only half of the elements of the real transform. The
 * other half satisfies the symmetry condition. If you want the full real
 * forward transform, use <code>realForwardFull</code>. To get back the
 * original data, use <code>realInverse</code> on the output of this method.
 *  
 * @param a    data to transform
 * @param offa index of the first element in array <code>a</code>
 */
public void realForward(double[] a, int offa)
{
    if (useLargeArrays) {
        realForward(new DoubleLargeArray(a), offa);
    } else {
        if (n == 1) {
            return;
        }

        switch (plan) {
            case SPLIT_RADIX:
                double xi;

                if (n > 4) {
                    CommonUtils.cftfsub(n, a, offa, ip, nw, w);
                    CommonUtils.rftfsub(n, a, offa, nc, w, nw);
                } else if (n == 4) {
                    CommonUtils.cftx020(a, offa);
                }
                xi = a[offa] - a[offa + 1];
                a[offa] += a[offa + 1];
                a[offa + 1] = xi;
                break;
            case MIXED_RADIX:
                rfftf(a, offa);
                for (int k = n - 1; k >= 2; k--) {
                    int idx = offa + k;
                    double tmp = a[idx];
                    a[idx] = a[idx - 1];
                    a[idx - 1] = tmp;
                }
                break;
            case BLUESTEIN:
                bluestein_real_forward(a, offa);
                break;
        }
    }
}
 
開發者ID:wendykierp,項目名稱:JTransforms,代碼行數:67,代碼來源:DoubleFFT_1D.java

示例2: realForward

import org.jtransforms.utils.CommonUtils; //導入方法依賴的package包/類
/**
 * Computes 1D forward DFT of real data leaving the result in <code>a</code>
 * . The physical layout of the output data is as follows:<br>
 *  
 * if n is even then
 *  
 * <pre>
 * a[offa+2*k] = Re[k], 0&lt;=k&lt;n/2 
 * a[offa+2*k+1] = Im[k], 0&lt;k&lt;n/2
 * a[offa+1] = Re[n/2]
 * </pre>
 *  
 * if n is odd then
 *  
 * <pre>
 * a[offa+2*k] = Re[k], 0&lt;=k&lt;(n+1)/2 
 * a[offa+2*k+1] = Im[k], 0&lt;k&lt;(n-1)/2 
 * a[offa+1] = Im[(n-1)/2]
 * </pre>
 *  
 * This method computes only half of the elements of the real transform. The
 * other half satisfies the symmetry condition. If you want the full real
 * forward transform, use <code>realForwardFull</code>. To get back the
 * original data, use <code>realInverse</code> on the output of this method.
 *  
 * @param a    data to transform
 * @param offa index of the first element in array <code>a</code>
 */
public void realForward(float[] a, int offa)
{
    if (useLargeArrays) {
        realForward(new FloatLargeArray(a), offa);
    } else {
        if (n == 1) {
            return;
        }

        switch (plan) {
            case SPLIT_RADIX:
                float xi;

                if (n > 4) {
                    CommonUtils.cftfsub(n, a, offa, ip, nw, w);
                    CommonUtils.rftfsub(n, a, offa, nc, w, nw);
                } else if (n == 4) {
                    CommonUtils.cftx020(a, offa);
                }
                xi = a[offa] - a[offa + 1];
                a[offa] += a[offa + 1];
                a[offa + 1] = xi;
                break;
            case MIXED_RADIX:
                rfftf(a, offa);
                for (int k = n - 1; k >= 2; k--) {
                    int idx = offa + k;
                    float tmp = a[idx];
                    a[idx] = a[idx - 1];
                    a[idx - 1] = tmp;
                }
                break;
            case BLUESTEIN:
                bluestein_real_forward(a, offa);
                break;
        }
    }
}
 
開發者ID:wendykierp,項目名稱:JTransforms,代碼行數:67,代碼來源:FloatFFT_1D.java


注:本文中的org.jtransforms.utils.CommonUtils.cftx020方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。