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 */
17package org.apache.commons.math.transform;
18
19import org.apache.commons.math.FunctionEvaluationException;
20import org.apache.commons.math.analysis.UnivariateRealFunction;
21
22/**
23 * Interface for one-dimensional data sets transformations producing real results.
24 * <p>Such transforms include {@link FastSineTransformer sine transform},
25 * {@link FastCosineTransformer cosine transform} or {@link
26 * FastHadamardTransformer Hadamard transform}. {@link FastFourierTransformer
27 * Fourier transform} is of a different kind and does not implement this
28 * interface since it produces {@link org.apache.commons.math.complex.Complex complex}
29 * results instead of real ones.
30 * </p>
31 * @version $Revision: 1070725 $ $Date: 2011-02-15 02:31:12 +0100 (mar. 15 févr. 2011) $
32 * @since 2.0
33 */
34public interface RealTransformer  {
35
36    /**
37     * Transform the given real data set.
38     * @param f the real data array to be transformed (signal)
39     * @return the real transformed array (spectrum)
40     * @throws IllegalArgumentException if any parameters are invalid
41     */
42    double[] transform(double f[])
43        throws IllegalArgumentException;
44
45    /**
46     * Transform the given real function, sampled on the given interval.
47     * @param f the function to be sampled and transformed
48     * @param min the lower bound for the interval
49     * @param max the upper bound for the interval
50     * @param n the number of sample points
51     * @return the real transformed array
52     * @throws FunctionEvaluationException if function cannot be evaluated at some point
53     * @throws IllegalArgumentException if any parameters are invalid
54     */
55    double[] transform(UnivariateRealFunction f, double min, double max, int n)
56        throws FunctionEvaluationException, IllegalArgumentException;
57
58    /**
59     * Inversely transform the given real data set.
60     * @param f the real data array to be inversely transformed (spectrum)
61     * @return the real inversely transformed array (signal)
62     * @throws IllegalArgumentException if any parameters are invalid
63     */
64    double[] inversetransform(double f[])
65        throws IllegalArgumentException;
66
67    /**
68     * Inversely transform the given real function, sampled on the given interval.
69     * @param f the function to be sampled and inversely transformed
70     * @param min the lower bound for the interval
71     * @param max the upper bound for the interval
72     * @param n the number of sample points
73     * @return the real inversely transformed array
74     * @throws FunctionEvaluationException if function cannot be evaluated at some point
75     * @throws IllegalArgumentException if any parameters are invalid
76     */
77    double[] inversetransform(UnivariateRealFunction f, double min, double max, int n)
78        throws FunctionEvaluationException, IllegalArgumentException;
79
80}
81