Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
polynomial.hh
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file numeric/polynomial.hh
11 /// @brief Polynomial evaluation class
12 /// @author Matthew O'Meara (mattjomeara@gmail.com)
13 
14 #ifndef INCLUDED_numeric_polynomial_hh
15 #define INCLUDED_numeric_polynomial_hh
16 
17 // Unit Headers
19 
20 // Numeric Headers
21 #include <numeric/types.hh>
22 
23 // Utility Headers
24 #include <utility/vector1.hh>
26 
27 // C++ Headers
28 #include <string>
29 #include <iostream>
30 
31 #ifdef SERIALIZATION
32 // Cereal headers
33 #include <cereal/access.fwd.hpp>
34 #include <cereal/types/polymorphic.fwd.hpp>
35 #endif // SERIALIZATION
36 
37 namespace numeric {
38 
40 
41 public:
42  //Polynomial_1d();
43 
45  std::string const & polynomial_name,
46  Real const xmin,
47  Real const xmax,
48  Real const min_val,
49  Real const max_val,
50  Real const root1,
51  Real const root2,
52  Size degree,
54 
55  Polynomial_1d(Polynomial_1d const & src );
56 
57  virtual ~Polynomial_1d();
58 
59  // check that the polynomial parameters are well formed
60  void
61  check_invariants() const;
62 
63  std::string
64  name() const;
65 
66  Real
67  xmin() const;
68 
69  Real
70  xmax() const;
71 
72  Real
73  min_val() const;
74 
75  Real
76  max_val() const;
77 
78  Real
79  root1() const;
80 
81  Real
82  root2() const;
83 
84  Size
85  degree() const;
86 
88  coefficients() const;
89 
90  /// @brief Evaluate the polynomial and its derivative
91  void
92  operator()(
93  double const variable,
94  double & value,
95  double & deriv) const;
96 
97  /// @brief just evaluate the polynomial, w/o derivatives
98  double
99  eval( double const variable );
100 
101  void
102  show( std::ostream & out ) const;
103 
104 private:
105  std::string polynomial_name_;
114 
115 #ifdef SERIALIZATION
116 protected:
117  friend class cereal::access;
118  Polynomial_1d();
119 
120 public:
121  template< class Archive > void save( Archive & arc ) const;
122  template< class Archive > void load( Archive & arc );
123 #endif // SERIALIZATION
124 
125 };
126 
127 std::ostream &
128 operator<< ( std::ostream & out, const Polynomial_1d & poly );
129 
130 } // numeric
131 
132 #ifdef SERIALIZATION
133 CEREAL_FORCE_DYNAMIC_INIT( numeric_polynomial )
134 #endif // SERIALIZATION
135 
136 
137 #endif // INCLUDED_numeric_polynomial_HH
virtual ~Polynomial_1d()
Definition: polynomial.cc:76
ReferenceCount base class – dispatch class.
Real max_val() const
Definition: polynomial.cc:127
Polynomial_1d(std::string const &polynomial_name, Real const xmin, Real const xmax, Real const min_val, Real const max_val, Real const root1, Real const root2, Size degree, utility::vector1< Real > const &coefficients)
ctor
Definition: polynomial.cc:48
Size degree() const
Definition: polynomial.cc:145
std::string polynomial_name_
Definition: polynomial.hh:105
Base class for reference-counted polymorphic classes.
Real root2() const
Definition: polynomial.cc:139
member1 value
Definition: Tag.cc:296
double eval(double const variable)
just evaluate the polynomial, w/o derivatives
Definition: polynomial.cc:214
Real xmax() const
Definition: polynomial.cc:115
rosetta project type declarations. Should be kept updated with core/types.hh. This exists because num...
utility::vector1< Real > const & coefficients() const
Definition: polynomial.cc:151
void operator()(double const variable, double &value, double &deriv) const
Evaluate the polynomial and its derivative.
Definition: polynomial.cc:189
utility::vector1< Real > coefficients_
Definition: polynomial.hh:113
Real xmin() const
Definition: polynomial.cc:109
vector1: std::vector with 1-based indexing
struct numeric::kinematic_closure::p poly
forward header for Polynomial class
Real min_val() const
Definition: polynomial.cc:121
std::string name() const
Definition: polynomial.cc:103
std::ostream & operator<<(std::ostream &stream, BodyPosition< T > const &p)
stream << BodyPosition output operator
void check_invariants() const
Definition: polynomial.cc:79
def load
Definition: IO.py:5
Real root1() const
Definition: polynomial.cc:133
void show(std::ostream &out) const
Definition: polynomial.cc:237