Jpp  17.1.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Friends | List of all members
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

Public Member Functions

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

Friends

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

Detailed Description

Polynome model.

Definition at line 28 of file JPolynome.hh.

Constructor & Destructor Documentation

JMATH::JPolynome_t::JPolynome_t ( )
inline

Default constructor.

Definition at line 36 of file JPolynome.hh.

37  {}

Member Function Documentation

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  }
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  }
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  }
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  }
JPolynome_t & JMATH::JMath< JPolynome_t , JNullType >::mul ( const JNullType object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 357 of file JMath.hh.

358  {
359  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
360  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18

Friends And Related Function Documentation

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  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
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:446

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