Example usage for org.apache.commons.math3.transform DstNormalization ORTHOGONAL_DST_I

List of usage examples for org.apache.commons.math3.transform DstNormalization ORTHOGONAL_DST_I

Introduction

In this page you can find the example usage for org.apache.commons.math3.transform DstNormalization ORTHOGONAL_DST_I.

Prototype

DstNormalization ORTHOGONAL_DST_I

To view the source code for org.apache.commons.math3.transform DstNormalization ORTHOGONAL_DST_I.

Click Source Link

Document

Should be passed to the constructor of FastSineTransformer to use the orthogonal normalization convention.

Usage

From source file:experiment.FastSineTransformer_bug.java

/**
 * {@inheritDoc}/*from w  ww  .  j a v a 2 s  .c  o m*/
 *
 * The first element of the specified data set is required to be {@code 0}.
 *
 * @throws MathIllegalArgumentException if the length of the data array is
 *   not a power of two, or the first element of the data array is not zero
 */
public double[] transform(final double[] f, final TransformType type) {
    if (normalization == DstNormalization.ORTHOGONAL_DST_I) {
        final double s = FastMath.sqrt(2.0 / f.length);
        return TransformUtils.scaleArray(fst(f), s);
    }
    if (type == TransformType.FORWARD) {
        return fst(f);
    }
    final double s = 2.0 / f.length;
    return TransformUtils.scaleArray(fst(f), s);
}