Polynome model.
More...
#include <JPolynome.hh>
Polynome model.
Definition at line 28 of file JPolynome.hh.
◆ JPolynome_t()
JMATH::JPolynome_t::JPolynome_t |
( |
| ) |
|
|
inline |
◆ equals()
bool JMATH::JPolynome_t::equals |
( |
const JPolynome_t & | P, |
|
|
const double | eps = std::numeric_limits<double>::min() ) const |
|
inline |
Equality.
- Parameters
-
P | polynome |
eps | numerical precision |
- Returns
- true if polynomes identical; else false
Definition at line 47 of file JPolynome.hh.
49 {
50 if (this->size() == P.size()) {
51
52 for (const_iterator p = this->begin(), q = P.begin(); p != this->end(); ++p, ++q) {
53 if (fabs(*p - *q) > eps) {
54 return false;
55 }
56 }
57
58 return true;
59
60 } else {
61
62 return false;
63 }
64 }
◆ add()
Add polynome.
- Parameters
-
- Returns
- this polynome
Definition at line 73 of file JPolynome.hh.
74 {
75 while (this->size() < polynome.size()) {
76 this->push_back(0.0);
77 }
78
79 for (size_t i = 0; i != this->size(); ++i) {
80 (*this)[i] += polynome[i];
81 }
82
83 return *this;
84 }
◆ sub()
Subtract polynome.
- Parameters
-
- Returns
- this polynome
Definition at line 93 of file JPolynome.hh.
94 {
95 while (this->size() < polynome.size()) {
96 this->push_back(0.0);
97 }
98
99 for (size_t i = 0; i != this->size(); ++i) {
100 (*this)[i] -= polynome[i];
101 }
102
103 return *this;
104 }
◆ mul() [1/2]
JPolynome_t & JMATH::JPolynome_t::mul |
( |
const double | factor | ) |
|
|
inline |
Scale polynome.
- Parameters
-
factor | multiplication factor |
- Returns
- this polynome
Definition at line 113 of file JPolynome.hh.
114 {
115 for (iterator i = begin(); i != end(); ++i) {
116 (*i) *= factor;
117 }
118
119 return *this;
120 }
◆ mul() [2/2]
Multiply with object.
- Parameters
-
- Returns
- result object
Definition at line 354 of file JMath.hh.
355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }
◆ operator>>
std::istream & operator>> |
( |
std::istream & | in, |
|
|
JPolynome_t & | object ) |
|
friend |
Read polynome from input.
- Parameters
-
in | input stream |
object | polynome |
- Returns
- input stream
Definition at line 130 of file JPolynome.hh.
131 {
132 for (
double x; in >>
x; ) {
133 object.push_back(x);
134 }
135
136 return in;
137 }
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const JPolynome_t & | object ) |
|
friend |
Write polynome to output.
- Parameters
-
out | output stream |
object | polynome |
- Returns
- output stream
Definition at line 147 of file JPolynome.hh.
148 {
149 for (JPolynome_t::const_iterator i = object.begin(); i != object.end(); ++i) {
150 out <<
' ' <<
FIXED(9,3) << *i;
151 }
152
153 return out;
154 }
Auxiliary data structure for floating point format specification.
The documentation for this struct was generated from the following file: