001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.commons.math.transform;
018
019 import org.apache.commons.math.FunctionEvaluationException;
020 import org.apache.commons.math.analysis.UnivariateRealFunction;
021 import org.apache.commons.math.complex.Complex;
022
023 /**
024 * Interface for one-dimensional data sets transformations producing real results.
025 * <p>Such transforms include {@link FastSineTransformer sine transform},
026 * {@link FastCosineTransformer cosine transform} or {@link
027 * FastHadamardTransformer Hadamard transform}. {@link FastFourierTransformer
028 * Fourier transform} is of a different kind and does not implement this
029 * interface since it produces {@link Complex complex} results instead of real
030 * ones.
031 * </p>
032 * @version $Revision: 780541 $ $Date: 2009-05-31 20:47:02 -0400 (Sun, 31 May 2009) $
033 * @since 2.0
034 */
035 public interface RealTransformer {
036
037 /**
038 * Transform the given real data set.
039 * @param f the real data array to be transformed (signal)
040 * @return the real transformed array (spectrum)
041 * @throws IllegalArgumentException if any parameters are invalid
042 */
043 double[] transform(double f[])
044 throws IllegalArgumentException;
045
046 /**
047 * Transform the given real function, sampled on the given interval.
048 * @param f the function to be sampled and transformed
049 * @param min the lower bound for the interval
050 * @param max the upper bound for the interval
051 * @param n the number of sample points
052 * @return the real transformed array
053 * @throws FunctionEvaluationException if function cannot be evaluated
054 * at some point
055 * @throws IllegalArgumentException if any parameters are invalid
056 */
057 double[] transform(UnivariateRealFunction f, double min, double max, int n)
058 throws FunctionEvaluationException, IllegalArgumentException;
059
060 /**
061 * Inversely transform the given real data set.
062 * @param f the real data array to be inversely transformed (spectrum)
063 * @return the real inversely transformed array (signal)
064 * @throws IllegalArgumentException if any parameters are invalid
065 */
066 public abstract double[] inversetransform(double f[])
067 throws IllegalArgumentException;
068
069 /**
070 * Inversely transform the given real function, sampled on the given interval.
071 * @param f the function to be sampled and inversely transformed
072 * @param min the lower bound for the interval
073 * @param max the upper bound for the interval
074 * @param n the number of sample points
075 * @return the real inversely transformed array
076 * @throws FunctionEvaluationException if function cannot be evaluated
077 * at some point
078 * @throws IllegalArgumentException if any parameters are invalid
079 */
080 double[] inversetransform(UnivariateRealFunction f, double min, double max, int n)
081 throws FunctionEvaluationException, IllegalArgumentException;
082
083 }