org.apache.commons.math3.transform

## Class TransformUtils

- java.lang.Object
- - org.apache.commons.math3.transform.TransformUtils

-     public class TransformUtils
      extends Object

  Useful functions for the implementation of various transforms.
  Since:
    3.0
  Version:
    $Id: TransformUtils.java 1244107 2012-02-14 16:17:55Z erans $

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Complex[]` | `createComplexArray(double[][] dataRI)` Builds a new array of `Complex` from the specified two dimensional array of real and imaginary parts.
    `static double[][]` | `createRealImaginaryArray(Complex[] dataC)` Builds a new two dimensional array of `double` filled with the real and imaginary parts of the specified `Complex` numbers.
    `static int` | `exactLog2(int n)` Returns the base-2 logarithm of the specified `int`.
    `static Complex[]` | `scaleArray(Complex[] f, double d)` Multiply every component in the given complex array by the given real number.
    `static double[]` | `scaleArray(double[] f, double d)` Multiply every component in the given real array by the given real number.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### scaleArray

          public static double[] scaleArray(double[] f,
                            double d)

      Multiply every component in the given real array by the given real number. The change is made in place.
      Parameters:
        `f` - the real array to be scaled
        `d` - the real scaling coefficient
      Returns:
        a reference to the scaled array

    - #### scaleArray

          public static Complex[] scaleArray(Complex[] f,
                             double d)

      Multiply every component in the given complex array by the given real number. The change is made in place.
      Parameters:
        `f` - the complex array to be scaled
        `d` - the real scaling coefficient
      Returns:
        a reference to the scaled array

    - #### createRealImaginaryArray

          public static double[][] createRealImaginaryArray(Complex[] dataC)

      Builds a new two dimensional array of `double` filled with the real and imaginary parts of the specified `Complex` numbers. In the returned array `dataRI`, the data is laid out as follows
      - `dataRI[0][i] = dataC[i].getReal()`,
      - `dataRI[1][i] = dataC[i].getImaginary()`.
      Parameters:
        `dataC` - the array of `Complex` data to be transformed
      Returns:
        a two dimensional array filled with the real and imaginary parts of the specified complex input

    - #### createComplexArray

          public static Complex[] createComplexArray(double[][] dataRI)
                                              throws DimensionMismatchException

      Builds a new array of `Complex` from the specified two dimensional array of real and imaginary parts. In the returned array `dataC`, the data is laid out as follows
      - `dataC[i].getReal() = dataRI[0][i]`,
      - `dataC[i].getImaginary() = dataRI[1][i]`.
      Parameters:
        `dataRI` - the array of real and imaginary parts to be transformed
      Returns:
        an array of `Complex` with specified real and imaginary parts.
      Throws:
        `DimensionMismatchException` - if the number of rows of the specified array is not two, or the array is not rectangular

    - #### exactLog2

          public static int exactLog2(int n)
                               throws MathIllegalArgumentException

      Returns the base-2 logarithm of the specified `int`. Throws an exception if `n` is not a power of two.
      Parameters:
        `n` - the `int` whose base-2 logarithm is to be evaluated
      Returns:
        the base-2 logarithm of `n`
      Throws:
        `MathIllegalArgumentException` - if `n` is not a power of two

Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.