View Javadoc
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    *      https://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  
18  /*
19   * This is not the original file distributed by the Apache Software Foundation
20   * It has been modified by the Hipparchus project
21   */
22  package org.hipparchus.transform;
23  
24  import org.hipparchus.analysis.UnivariateFunction;
25  import org.hipparchus.exception.MathIllegalArgumentException;
26  
27  /**
28   * Interface for one-dimensional data sets transformations producing real results.
29   * <p>
30   * Such transforms include {@link FastSineTransformer sine transform},
31   * {@link FastCosineTransformer cosine transform} or {@link
32   * FastHadamardTransformer Hadamard transform}. {@link FastFourierTransformer
33   * Fourier transform} is of a different kind and does not implement this
34   * interface since it produces {@link org.hipparchus.complex.Complex}
35   * results instead of real ones.
36   *
37   */
38  public interface RealTransformer  {
39  
40      /**
41       * Returns the (forward, inverse) transform of the specified real data set.
42       *
43       * @param f the real data array to be transformed (signal)
44       * @param type the type of transform (forward, inverse) to be performed
45       * @return the real transformed array (spectrum)
46       * @throws MathIllegalArgumentException if the array cannot be transformed
47       *   with the given type (this may be for example due to array size, which is
48       *   constrained in some transforms)
49       */
50      double[] transform(double[] f, TransformType type) throws MathIllegalArgumentException;
51  
52      /**
53       * Returns the (forward, inverse) transform of the specified real function,
54       * sampled on the specified interval.
55       *
56       * @param f the function to be sampled and transformed
57       * @param min the (inclusive) lower bound for the interval
58       * @param max the (exclusive) upper bound for the interval
59       * @param n the number of sample points
60       * @param type the type of transform (forward, inverse) to be performed
61       * @return the real transformed array
62       * @throws MathIllegalArgumentException if the lower bound is greater than, or equal to the upper bound
63       * @throws MathIllegalArgumentException if the number of sample points is negative
64       * @throws MathIllegalArgumentException if the sample cannot be transformed
65       *   with the given type (this may be for example due to sample size, which is
66       *   constrained in some transforms)
67       */
68      double[] transform(UnivariateFunction f, double min, double max, int n,
69                         TransformType type)
70          throws MathIllegalArgumentException;
71  
72  }