Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JMATH::JPolynome_t Struct Reference

Polynome model. More...

#include <JPolynome.hh>

Inheritance diagram for JMATH::JPolynome_t:
std::vector< double > JMATH::JMath< JPolynome_t > JLANG::JEquals< JFirst_t, JSecond_t > JMATH::JPolynome< ID_t, N >

Public Member Functions

 JPolynome_t ()
 Default constructor.
 
bool equals (const JPolynome_t &P, const double eps=std::numeric_limits< double >::min()) const
 Equality.
 
JPolynome_tadd (const JPolynome_t &polynome)
 Add polynome.
 
JPolynome_tsub (const JPolynome_t &polynome)
 Subtract polynome.
 
JPolynome_tmul (const double factor)
 Scale polynome.
 
JPolynome_tmul (const JSecond_t &object)
 Multiply with object.
 

Friends

std::istream & operator>> (std::istream &in, JPolynome_t &object)
 Read polynome from input.
 
std::ostream & operator<< (std::ostream &out, const JPolynome_t &object)
 Write polynome to output.
 

Detailed Description

Polynome model.

Definition at line 28 of file JPolynome.hh.

Constructor & Destructor Documentation

◆ JPolynome_t()

JMATH::JPolynome_t::JPolynome_t ( )
inline

Default constructor.

Definition at line 36 of file JPolynome.hh.

37 {}

Member Function Documentation

◆ equals()

bool JMATH::JPolynome_t::equals ( const JPolynome_t & P,
const double eps = std::numeric_limits<double>::min() ) const
inline

Equality.

Parameters
Ppolynome
epsnumerical 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()

JPolynome_t & JMATH::JPolynome_t::add ( const JPolynome_t & polynome)
inline

Add polynome.

Parameters
polynomepolynome
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()

JPolynome_t & JMATH::JPolynome_t::sub ( const JPolynome_t & polynome)
inline

Subtract polynome.

Parameters
polynomepolynome
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
factormultiplication 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]

JPolynome_t & JMATH::JMath< JPolynome_t, JSecond_t >::mul ( const JSecond_t & object)
inlineinherited

Multiply with object.

Parameters
objectobject
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 }

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream & in,
JPolynome_t & object )
friend

Read polynome from input.

Parameters
ininput stream
objectpolynome
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
outoutput stream
objectpolynome
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.
Definition JManip.hh:448

The documentation for this struct was generated from the following file: