mirror of
https://github.com/VictorEijkhout/TheArtOfHPC_vol3_cppf08programming.git
synced 2026-01-24 22:44:48 +09:00
30 lines
681 B
C++
30 lines
681 B
C++
// -*- c++ -*-
|
|
/****************************************************************
|
|
****
|
|
**** This file belongs with the course
|
|
**** Introduction to Scientific Programming in C++/Fortran2003
|
|
**** copyright 2017 Victor Eijkhout eijkhout@tacc.utexas.edu
|
|
****
|
|
**** poly.h : polynomial class proto
|
|
****
|
|
****************************************************************/
|
|
|
|
#include <vector>
|
|
|
|
class polynomial {
|
|
private:
|
|
std::vector<double> coefficients;
|
|
public:
|
|
polynomial();
|
|
// creation related
|
|
void read();
|
|
void print();
|
|
void set_positive();
|
|
// stats
|
|
int degree();
|
|
bool is_even() const; bool is_odd() const;
|
|
// numeric
|
|
double evaluate_at(double x) const;
|
|
};
|
|
|