🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
Zeros.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "zeros.h"
25
26AST_NAMESPACE_BEGIN
27
28namespace details{
29 template<typename Func>
30 A_ALWAYS_INLINE double callback_func(double x, void* func)
31 {
32 return (*(Func*)func)(x);
33 }
34}
35
52template<typename Func>
53double bisect(Func f, double xa, double xb, double xtol, double rtol, int iter, scipy_zeros_info &solver_stats)
54{
55 return ::bisect(details::callback_func<Func>, xa, xb, xtol, rtol, iter, &f, &solver_stats);
56}
57
58
69template<typename Func>
70double ridder(Func f, double xa, double xb, double xtol, double rtol, int iter, scipy_zeros_info &solver_stats)
71{
72 return ::ridder(details::callback_func<Func>, xa, xb, xtol, rtol, iter, &f, &solver_stats);
73}
74
75
86template<typename Func>
87double brenth(Func f, double xa, double xb, double xtol, double rtol, int iter, scipy_zeros_info &solver_stats)
88{
89 return ::brenth(details::callback_func<Func>, xa, xb, xtol, rtol, iter, &f, &solver_stats);
90}
91
92
103template<typename Func>
104double brentq(Func f, double xa, double xb, double xtol, double rtol, int iter, scipy_zeros_info &solver_stats)
105{
106 return ::brentq(details::callback_func<Func>, xa, xb, xtol, rtol, iter, &f, &solver_stats);
107}
108
109
120template<typename Func>
121double secant(Func f, double xa, double xb, double xtol, double rtol, int iter, scipy_zeros_info &solver_stats)
122{
123 return ::secant(details::callback_func<Func>, xa, xb, xtol, rtol, iter, &f, &solver_stats);
124}
125
126
129AST_NAMESPACE_END