Package adams.data.padding
Class PaddingHelper
- java.lang.Object
-
- adams.data.padding.PaddingHelper
-
public class PaddingHelper extends Object
Helper for padding operations.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description PaddingHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
nextPowerOf2(int n)
Returns the next bigger number that's a power of 2.static double[]
pad(double[] data, int numPoints, PaddingType type)
Pads the data to the specified number of data points (pads on the right).static double[]
pad(double[] data, int numPoints, PaddingType type, boolean padLeft)
Pads the data to the specified number of data points.static float[]
pad(float[] data, int numPoints, PaddingType type)
Pads the data to the specified number of data points (pads on the right).static float[]
pad(float[] data, int numPoints, PaddingType type, boolean padLeft)
Pads the data to the specified number of data points.static double[]
padPow2(double[] data, PaddingType type)
Pads the data to the next power of 2.static double[]
padPow2(double[] data, PaddingType type, boolean padLeft)
Pads the data to the next power of 2.static float[]
padPow2(float[] data, PaddingType type)
Pads the data to the next power of 2 (pads on the right).static float[]
padPow2(float[] data, PaddingType type, boolean padLeft)
Pads the data to the next power of 2.
-
-
-
Method Detail
-
nextPowerOf2
public static int nextPowerOf2(int n)
Returns the next bigger number that's a power of 2. If the number is already a power of 2 then this will be returned. The number will be at least 2^2.- Parameters:
n
- the number to start from- Returns:
- the next bigger number
-
padPow2
public static float[] padPow2(float[] data, PaddingType type)
Pads the data to the next power of 2 (pads on the right).- Parameters:
data
- the data to padtype
- what values to pad- Returns:
- the padded data
-
padPow2
public static float[] padPow2(float[] data, PaddingType type, boolean padLeft)
Pads the data to the next power of 2.- Parameters:
data
- the data to padtype
- what values to padpadLeft
- whether to pad on the left rather than right- Returns:
- the padded data
-
pad
public static float[] pad(float[] data, int numPoints, PaddingType type)
Pads the data to the specified number of data points (pads on the right).- Parameters:
data
- the data to padnumPoints
- the number of data points for the resulttype
- what values to pad- Returns:
- the padded data
-
pad
public static float[] pad(float[] data, int numPoints, PaddingType type, boolean padLeft)
Pads the data to the specified number of data points.- Parameters:
data
- the data to padnumPoints
- the number of data points for the resulttype
- what values to padpadLeft
- whether to pad on the left rather than right- Returns:
- the padded data
-
padPow2
public static double[] padPow2(double[] data, PaddingType type)
Pads the data to the next power of 2.- Parameters:
data
- the data to padtype
- what values to pad- Returns:
- the padded data
-
padPow2
public static double[] padPow2(double[] data, PaddingType type, boolean padLeft)
Pads the data to the next power of 2.- Parameters:
data
- the data to padtype
- what values to padpadLeft
- whether to pad on the left rather than right- Returns:
- the padded data
-
pad
public static double[] pad(double[] data, int numPoints, PaddingType type)
Pads the data to the specified number of data points (pads on the right).- Parameters:
data
- the data to padnumPoints
- the number of data points for the resulttype
- what values to pad- Returns:
- the padded data
-
pad
public static double[] pad(double[] data, int numPoints, PaddingType type, boolean padLeft)
Pads the data to the specified number of data points.- Parameters:
data
- the data to padnumPoints
- the number of data points for the resulttype
- what values to padpadLeft
- whether to pad on the left rather than right- Returns:
- the padded data
-
-