1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.commons.math.transform;
18
19 import org.apache.commons.math.FunctionEvaluationException;
20 import org.apache.commons.math.analysis.UnivariateRealFunction;
21 import org.apache.commons.math.complex.Complex;
22
23 /**
24 * Interface for one-dimensional data sets transformations producing real results.
25 * <p>Such transforms include {@link FastSineTransformer sine transform},
26 * {@link FastCosineTransformer cosine transform} or {@link
27 * FastHadamardTransformer Hadamard transform}. {@link FastFourierTransformer
28 * Fourier transform} is of a different kind and does not implement this
29 * interface since it produces {@link Complex complex} results instead of real
30 * ones.
31 * </p>
32 * @version $Revision: 780541 $ $Date: 2009-05-31 20:47:02 -0400 (Sun, 31 May 2009) $
33 * @since 2.0
34 */
35 public interface RealTransformer {
36
37 /**
38 * Transform the given real data set.
39 * @param f the real data array to be transformed (signal)
40 * @return the real transformed array (spectrum)
41 * @throws IllegalArgumentException if any parameters are invalid
42 */
43 double[] transform(double f[])
44 throws IllegalArgumentException;
45
46 /**
47 * Transform the given real function, sampled on the given interval.
48 * @param f the function to be sampled and transformed
49 * @param min the lower bound for the interval
50 * @param max the upper bound for the interval
51 * @param n the number of sample points
52 * @return the real transformed array
53 * @throws FunctionEvaluationException if function cannot be evaluated
54 * at some point
55 * @throws IllegalArgumentException if any parameters are invalid
56 */
57 double[] transform(UnivariateRealFunction f, double min, double max, int n)
58 throws FunctionEvaluationException, IllegalArgumentException;
59
60 /**
61 * Inversely transform the given real data set.
62 * @param f the real data array to be inversely transformed (spectrum)
63 * @return the real inversely transformed array (signal)
64 * @throws IllegalArgumentException if any parameters are invalid
65 */
66 public abstract double[] inversetransform(double f[])
67 throws IllegalArgumentException;
68
69 /**
70 * Inversely transform the given real function, sampled on the given interval.
71 * @param f the function to be sampled and inversely transformed
72 * @param min the lower bound for the interval
73 * @param max the upper bound for the interval
74 * @param n the number of sample points
75 * @return the real inversely transformed array
76 * @throws FunctionEvaluationException if function cannot be evaluated
77 * at some point
78 * @throws IllegalArgumentException if any parameters are invalid
79 */
80 double[] inversetransform(UnivariateRealFunction f, double min, double max, int n)
81 throws FunctionEvaluationException, IllegalArgumentException;
82
83 }