3 #ifndef MYGSL_POLYNOMIAL_H 4 #define MYGSL_POLYNOMIAL_H 1 43 polynomial(
double c0_,
double c1_,
double c2_);
64 void set_coeff(
unsigned int i_,
double coeff_);
66 void print(std::ostream& out_ = std::clog,
68 bool eol_ =
false)
const;
84 static bool solve_linear(
double p0_,
double p1_,
unsigned int& nsols_,
92 unsigned int & nsols_,
double & x0_,
double & x1_);
98 static bool solve_cubic(
double p0_,
double p1_,
double p2_,
99 unsigned int & nsols_,
100 double & x0_,
double & x1_,
double & x2_);
106 static bool solve_cubic(
double p0_,
double p1_,
double p2_,
double p3_,
107 unsigned int & nsols_,
108 double & x0_,
double & x1_,
double & x2_);
117 double y1_,
double y2_,
double y3_,
118 double & p2_,
double & p1_,
double & p0_);
127 double y1_,
double y2_,
128 double & p1_,
double & p0_);
131 double y1_,
double y2_);
134 double y1_,
double y2_,
double y3_);
137 virtual void tree_dump(std::ostream & out_ = std::clog,
138 const std::string & title_ =
"",
139 const std::string & indent_ =
"",
140 bool inherit_ =
false)
const;
144 double _eval(
double x_)
const;
150 solver(
unsigned int sz_ = 0);
159 void _init_(
unsigned int);
169 std::vector<double> _c_;
185 #endif // MYGSL_POLYNOMIAL_H #define DATATOOLS_CLONEABLE_DECLARATION(Copyable)
Definition: i_cloneable.h:113
double _eval(double x_) const
The function evaluation abstract method.
virtual bool is_initialized() const
Check initialization status.
bool make_parabola(double x1_, double x2_, double x3_, double y1_, double y2_, double y3_)
double get_coeff(unsigned int i_) const
size_t fetch_solutions(std::vector< std::complex< double > > &zsols_)
bool is_valid() const
Check validity of the polynomial.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart printing.
bool is_initialized() const
void print(std::ostream &out_=std::clog, int format_=0, bool eol_=false) const
#define DATATOOLS_SERIALIZATION_DECLARATION()
Definition: i_serializable.h:266
virtual ~polynomial()
Destructor.
unsigned int get_ncoeffs() const
const std::vector< double > & get_coefficients() const
static bool solve_cubic(double p0_, double p1_, double p2_, unsigned int &nsols_, double &x0_, double &x1_, double &x2_)
void reset()
Reset the polynomial.
static bool solve_linear(double p0_, double p1_, unsigned int &nsols_, double &x0_)
Definition: polynomial.h:148
virtual void initialize(const datatools::properties &config_, const unary_function_dict_type &functors_)
Initialization from a container of parameters and a dictionary of functors.
static bool compute_line(double x1_, double x2_, double y1_, double y2_, double &p1_, double &p0_)
polynomial()
Default constructor.
Abstract interface for unary functions : R -> R.
Definition: i_unary_function.h:44
size_t fetch_real_solutions(std::vector< double > &rsols_, double precision_=-1.0)
bool make_line(double x1_, double x2_, double y1_, double y2_)
static bool compute_parabola(double x1_, double x2_, double x3_, double y1_, double y2_, double y3_, double &p2_, double &p1_, double &p0_)
void set_coeff(unsigned int i_, double coeff_)
void set_coefficients(const std::vector< double > &c_)
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
std::map< std::string, unary_function_handle_type > unary_function_dict_type
Alias for dictionary of handles to unary function objects.
Definition: unary_function_utils.h:30
#define MYGSL_UNARY_FUNCTOR_REGISTRATION_INTERFACE(UnaryFunctorClass)
Definition: i_unary_function.h:206
static bool solve_quadratic(double p0_, double p1_, double p2_, unsigned int &nsols_, double &x0_, double &x1_)
solver(unsigned int sz_=0)
bool solve(const polynomial &p_)
unsigned int get_degree() const
A real polynomial of arbitrary degree.
Definition: polynomial.h:20