// Copyright (C) 2026 Kiyotsugu Arai
// SPDX-License-Identifier: LGPL-3.0-or-later

// optimization_1d.hpp
#ifndef SANGI_OPTIMIZATION_1D_HPP
#define SANGI_OPTIMIZATION_1D_HPP

#include "optimization_base.hpp"

namespace sangi {

/**
 * @brief One-dimensional minimization by the golden-section search
 * @tparam T A field type with an order structure (real numbers, etc.)
 * @param f The function to minimize
 * @param a Lower bound of the interval
 * @param b Upper bound of the interval
 * @param options Optimization options
 * @return A tuple of the minimizing point, the minimum value, and the optimization status
 */
template<concepts::OrderedField T>
OptimizationResult1D<T> golden_section_search(
    const std::function<T(T)>& f,
    T a, T b,
    const OptimizationOptions<T>& options = OptimizationOptions<T>());

/**
 * @brief One-dimensional minimization by Brent's method
 * @tparam T A field type with an order structure (real numbers, etc.)
 * @param f The function to minimize
 * @param a Lower bound of the interval
 * @param b Upper bound of the interval
 * @param options Optimization options
 * @return A tuple of the minimizing point, the minimum value, and the optimization status
 */
template<concepts::OrderedField T>
OptimizationResult1D<T> brent_minimize(
    const std::function<T(T)>& f,
    T a, T b,
    const OptimizationOptions<T>& options = OptimizationOptions<T>());

// Add other one-dimensional optimization algorithms here

// Implementation is separated into optimization_1d_impl.hpp.

} // namespace sangi

#endif // SANGI_OPTIMIZATION_1D_HPP