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 */ 017package org.apache.commons.math4.transform; 018 019import java.util.function.DoubleUnaryOperator; 020import java.util.function.UnaryOperator; 021 022/** 023 * Real transforms. 024 */ 025public interface RealTransform extends UnaryOperator<double[]> { 026 /** 027 * Returns the transform of the specified data set. 028 * 029 * @param f the data array to be transformed (signal). 030 * @return the transformed array (spectrum). 031 * @throws IllegalArgumentException if the transform cannot be performed. 032 */ 033 @Override 034 double[] apply(double[] f); 035 036 /** 037 * Returns the transform of the specified function. 038 * 039 * @param f Function to be sampled and transformed. 040 * @param min Lower bound (inclusive) of the interval. 041 * @param max Upper bound (exclusive) of the interval. 042 * @param n Number of sample points. 043 * @return the result. 044 * @throws IllegalArgumentException if the transform cannot be performed. 045 */ 046 default double[] apply(DoubleUnaryOperator f, 047 double min, 048 double max, 049 int n) { 050 return apply(TransformUtils.sample(f, min, max, n)); 051 } 052}