All Downloads are FREE. Search and download functionalities are using the official Maven repository.

smile.math.MultivariateFunction Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2010-2020 Haifeng Li. All rights reserved.
 *
 * Smile is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * Smile is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Smile.  If not, see .
 ******************************************************************************/

package smile.math;

import java.io.Serializable;
import java.util.function.ToDoubleFunction;

/**
 * An interface representing a multivariate real function.
 *
 * @author Haifeng Li
 */
public interface MultivariateFunction extends ToDoubleFunction, Serializable {
    /**
     * Computes the value of the function at x.
     */
    double f(double[] x);

    /**
     * Computes the value of the function at x.
     * It delegates the computation to f().
     * This is simply for Scala convenience.
     */
    default double apply(double... x) {
        return f(x);
    }

    @Override
    default double applyAsDouble(double[] x) {
        return f(x);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy