Jpp
 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< JPolynome_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 26 of file JPolynome.hh.

Constructor & Destructor Documentation

JMATH::JPolynome_t::JPolynome_t ( )
inline

Default constructor.

Definition at line 34 of file JPolynome.hh.

35  {}

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 45 of file JPolynome.hh.

47  {
48  if (this->size() == P.size()) {
49 
50  for (const_iterator p = this->begin(), q = P.begin(); p != this->end(); ++p, ++q) {
51  if (fabs(*p - *q) > eps) {
52  return false;
53  }
54  }
55 
56  return true;
57 
58  } else {
59 
60  return false;
61  }
62  }
JPolynome_t& JMATH::JPolynome_t::add ( const JPolynome_t polynome)
inline

Add polynome.

Parameters
polynomepolynome
Returns
this polynome

Definition at line 71 of file JPolynome.hh.

72  {
73  while (this->size() < polynome.size()) {
74  this->push_back(0.0);
75  }
76 
77  for (size_t i = 0; i != this->size(); ++i) {
78  (*this)[i] += polynome[i];
79  }
80 
81  return *this;
82  }
JPolynome_t& JMATH::JPolynome_t::sub ( const JPolynome_t polynome)
inline

Subtract polynome.

Parameters
polynomepolynome
Returns
this polynome

Definition at line 91 of file JPolynome.hh.

92  {
93  while (this->size() < polynome.size()) {
94  this->push_back(0.0);
95  }
96 
97  for (size_t i = 0; i != this->size(); ++i) {
98  (*this)[i] -= polynome[i];
99  }
100 
101  return *this;
102  }
JPolynome_t& JMATH::JPolynome_t::mul ( const double  factor)
inline

Scale polynome.

Parameters
factormultiplication factor
Returns
this polynome

Definition at line 111 of file JPolynome.hh.

112  {
113  for (iterator i = begin(); i != end(); ++i) {
114  (*i) *= factor;
115  }
116 
117  return *this;
118  }
JPolynome_t & JMATH::JMath< JPolynome_t , JNullType >::mul ( const JNullType object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }
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 128 of file JPolynome.hh.

129  {
130  for (double x; in >> x; ) {
131  object.push_back(x);
132  }
133 
134  return in;
135  }
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
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 145 of file JPolynome.hh.

146  {
147  for (JPolynome_t::const_iterator i = object.begin(); i != object.end(); ++i) {
148  out << ' ' << FIXED(9,3) << *i;
149  }
150 
151  return out;
152  }
Auxiliary data structure for floating point format specification.
Definition: JPrint.hh:481

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