|
|
// kdoc -f html -d bsp28.DOCU -n polynom -p bsp_28_fkt.hpp #ifndef BSP_28_FKT #define BSP_28_FKT #include#include using namespace std; /** A class for 1D-polynomials p(x) with real coefficients. @short A class for polynomials with real coefficients. @author Gundolf Haase @since June 1, 2007 */ class polynom { // Methods public: // polynom(); // polynom(const polynom& rhs); // polynom(const string& file_name); // ~polynom(); // polynom& operator=(const polynom& rhs); /** Calculates p(@p x) via the Horner scheme @param x evaluation point @return p(@p x) */ double horner(const double x) const; /** Calculates p(@p x) via the a simple loop wherein the power of @p x is increased in each loop by multiplication. @param x evaluation point @return p(@p x) */ double polynom_mult(const double x) const; /** Calculates p(@p x) via the a simple loop wherein the power of @p x is calculated with the pow(x,n) function. @param x evaluation point @return p(@p x) */ double polynom_pow(const double x) const; // Inlined access methods /** @return polynomila degree */ const int& degree() const { return ngrad; }; /** @return coefficient for index @p i which is related to the i-th power of x */ const double& operator[](const int&i) const { return coeff[i]; }; /** @return coefficient for index @p i which is related to the i-th power of x */ double& operator[](const int&i) { return coeff[i]; }; // Members private: int ngrad; // Degree of the polynom double *coeff; // dynam. array of polynomial coefficients for ascending degree, // i.e. coeff[k] * x^ks }; // No friend method of class polynom anymore because of access methods ostream & operator<<(ostream & s, const polynom & orig); #endif
Generated by: ghaase on mephisto on Fri Jun 1 14:16:44 2007, using kdoc 2.0a54. |