public class FastCosineTransformer extends java.lang.Object implements RealTransformer
FCT is its own inverse, up to a multiplier depending on conventions. The equations are listed in the comments of the corresponding methods.
Different from FFT and FST, FCT requires the length of data set to be power of 2 plus one. Users should especially pay attention to the function transformation on how this affects the sampling.
As of version 2.0 this no longer implements Serializable
Constructor and Description |
---|
FastCosineTransformer()
Construct a default transformer.
|
Modifier and Type | Method and Description |
---|---|
double[] |
inversetransform(double[] f)
Inversely transform the given real data set.
|
double[] |
inversetransform(UnivariateRealFunction f,
double min,
double max,
int n)
Inversely transform the given real function, sampled on the given interval.
|
double[] |
inversetransform2(double[] f)
Inversely transform the given real data set.
|
double[] |
inversetransform2(UnivariateRealFunction f,
double min,
double max,
int n)
Inversely transform the given real function, sampled on the given interval.
|
double[] |
transform(double[] f)
Transform the given real data set.
|
double[] |
transform(UnivariateRealFunction f,
double min,
double max,
int n)
Transform the given real function, sampled on the given interval.
|
double[] |
transform2(double[] f)
Transform the given real data set.
|
double[] |
transform2(UnivariateRealFunction f,
double min,
double max,
int n)
Transform the given real function, sampled on the given interval.
|
public FastCosineTransformer()
public double[] transform(double[] f) throws java.lang.IllegalArgumentException
The formula is Fn = (1/2) [f0 + (-1)n fN] + ∑k=1N-1 fk cos(π nk/N)
transform
in interface RealTransformer
f
- the real data array to be transformedjava.lang.IllegalArgumentException
- if any parameters are invalidpublic double[] transform(UnivariateRealFunction f, double min, double max, int n) throws FunctionEvaluationException, java.lang.IllegalArgumentException
The formula is Fn = (1/2) [f0 + (-1)n fN] + ∑k=1N-1 fk cos(π nk/N)
transform
in interface RealTransformer
f
- the function to be sampled and transformedmin
- the lower bound for the intervalmax
- the upper bound for the intervaln
- the number of sample pointsFunctionEvaluationException
- if function cannot be evaluated
at some pointjava.lang.IllegalArgumentException
- if any parameters are invalidpublic double[] transform2(double[] f) throws java.lang.IllegalArgumentException
The formula is Fn = √(1/2N) [f0 + (-1)n fN] + √(2/N) ∑k=1N-1 fk cos(π nk/N)
f
- the real data array to be transformedjava.lang.IllegalArgumentException
- if any parameters are invalidpublic double[] transform2(UnivariateRealFunction f, double min, double max, int n) throws FunctionEvaluationException, java.lang.IllegalArgumentException
The formula is Fn = √(1/2N) [f0 + (-1)n fN] + √(2/N) ∑k=1N-1 fk cos(π nk/N)
f
- the function to be sampled and transformedmin
- the lower bound for the intervalmax
- the upper bound for the intervaln
- the number of sample pointsFunctionEvaluationException
- if function cannot be evaluated
at some pointjava.lang.IllegalArgumentException
- if any parameters are invalidpublic double[] inversetransform(double[] f) throws java.lang.IllegalArgumentException
The formula is fk = (1/N) [F0 + (-1)k FN] + (2/N) ∑n=1N-1 Fn cos(π nk/N)
inversetransform
in interface RealTransformer
f
- the real data array to be inversely transformedjava.lang.IllegalArgumentException
- if any parameters are invalidpublic double[] inversetransform(UnivariateRealFunction f, double min, double max, int n) throws FunctionEvaluationException, java.lang.IllegalArgumentException
The formula is fk = (1/N) [F0 + (-1)k FN] + (2/N) ∑n=1N-1 Fn cos(π nk/N)
inversetransform
in interface RealTransformer
f
- the function to be sampled and inversely transformedmin
- the lower bound for the intervalmax
- the upper bound for the intervaln
- the number of sample pointsFunctionEvaluationException
- if function cannot be evaluated at some pointjava.lang.IllegalArgumentException
- if any parameters are invalidpublic double[] inversetransform2(double[] f) throws java.lang.IllegalArgumentException
The formula is fk = √(1/2N) [F0 + (-1)k FN] + √(2/N) ∑n=1N-1 Fn cos(π nk/N)
f
- the real data array to be inversely transformedjava.lang.IllegalArgumentException
- if any parameters are invalidpublic double[] inversetransform2(UnivariateRealFunction f, double min, double max, int n) throws FunctionEvaluationException, java.lang.IllegalArgumentException
The formula is fk = √(1/2N) [F0 + (-1)k FN] + √(2/N) ∑n=1N-1 Fn cos(π nk/N)
f
- the function to be sampled and inversely transformedmin
- the lower bound for the intervalmax
- the upper bound for the intervaln
- the number of sample pointsFunctionEvaluationException
- if function cannot be evaluated at some pointjava.lang.IllegalArgumentException
- if any parameters are invalid"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"