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 022 /** 023 * Interface for one-dimensional data sets transformations producing real results. 024 * <p>Such transforms include {@link FastSineTransformer sine transform}, 025 * {@link FastCosineTransformer cosine transform} or {@link 026 * FastHadamardTransformer Hadamard transform}. {@link FastFourierTransformer 027 * Fourier transform} is of a different kind and does not implement this 028 * interface since it produces {@link org.apache.commons.math.complex.Complex complex} 029 * results instead of real ones. 030 * </p> 031 * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $ 032 * @since 2.0 033 */ 034 public interface RealTransformer { 035 036 /** 037 * Transform the given real data set. 038 * @param f the real data array to be transformed (signal) 039 * @return the real transformed array (spectrum) 040 * @throws IllegalArgumentException if any parameters are invalid 041 */ 042 double[] transform(double f[]) 043 throws IllegalArgumentException; 044 045 /** 046 * Transform the given real function, sampled on the given interval. 047 * @param f the function to be sampled and transformed 048 * @param min the lower bound for the interval 049 * @param max the upper bound for the interval 050 * @param n the number of sample points 051 * @return the real transformed array 052 * @throws FunctionEvaluationException if function cannot be evaluated 053 * at some point 054 * @throws IllegalArgumentException if any parameters are invalid 055 */ 056 double[] transform(UnivariateRealFunction f, double min, double max, int n) 057 throws FunctionEvaluationException, IllegalArgumentException; 058 059 /** 060 * Inversely transform the given real data set. 061 * @param f the real data array to be inversely transformed (spectrum) 062 * @return the real inversely transformed array (signal) 063 * @throws IllegalArgumentException if any parameters are invalid 064 */ 065 double[] inversetransform(double f[]) 066 throws IllegalArgumentException; 067 068 /** 069 * Inversely transform the given real function, sampled on the given interval. 070 * @param f the function to be sampled and inversely transformed 071 * @param min the lower bound for the interval 072 * @param max the upper bound for the interval 073 * @param n the number of sample points 074 * @return the real inversely transformed array 075 * @throws FunctionEvaluationException if function cannot be evaluated 076 * at some point 077 * @throws IllegalArgumentException if any parameters are invalid 078 */ 079 double[] inversetransform(UnivariateRealFunction f, double min, double max, int n) 080 throws FunctionEvaluationException, IllegalArgumentException; 081 082 }