Jpp  17.3.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Friends | List of all members
JMATH::JModel_t Struct Reference

Fit model. More...

#include <JModel.hh>

Inheritance diagram for JMATH::JModel_t:
std::vector< double > JMATH::JMath< JModel_t >

Public Types

typedef size_t parameter_type
 

Public Member Functions

JModel_toperator= (const JMATH::JZero &zero)
 Reset. More...
 
double & operator[] (const size_t index)
 Get value at given index. More...
 
bool equals (const JModel_t &model, const double eps=std::numeric_limits< double >::min()) const
 Equality. More...
 
JModel_tnegate ()
 Negate model. More...
 
JModel_tadd (const JModel_t &model)
 Add model. More...
 
JModel_tsub (const JModel_t &model)
 Subtract model. More...
 
JModel_tmul (const double factor)
 Scale model. More...
 
JModel_tdiv (const double factor)
 Scale model. More...
 
JModel_tmul (const JNullType &object)
 Multiply with object. More...
 

Friends

std::istream & operator>> (std::istream &in, JModel_t &model)
 Write model to input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JModel_t &model)
 Write model to output stream. More...
 

Detailed Description

Fit model.

Definition at line 29 of file JMath/JModel.hh.

Member Typedef Documentation

Definition at line 35 of file JMath/JModel.hh.

Member Function Documentation

JModel_t& JMATH::JModel_t::operator= ( const JMATH::JZero zero)
inline

Reset.

Parameters
zerozero
Returns
this model

Definition at line 43 of file JMath/JModel.hh.

44  {
45  for (size_t i = 0; i != this->size(); ++i) {
46  (*this)[i] = 0.0;
47  }
48 
49  return *this;
50  }
double& JMATH::JModel_t::operator[] ( const size_t  index)
inline

Get value at given index.

Parameters
indexindex
Returns
value

Definition at line 59 of file JMath/JModel.hh.

60  {
61  if (index >= this->size()) {
62  this->resize(index + 1, 0.0);
63  }
64 
65  return std::vector<double>::operator[](index);
66  }
bool JMATH::JModel_t::equals ( const JModel_t model,
const double  eps = std::numeric_limits<double>::min() 
) const
inline

Equality.

Parameters
modelmodel
epsnumerical precision
Returns
true if model's identical; else false

Definition at line 76 of file JMath/JModel.hh.

78  {
79  for (size_t i = 0; i != this->size(); ++i) {
80  if (fabs((*this)[i] - model[i]) >= eps) {
81  return false;
82  }
83  }
84 
85  return true;
86  }
JModel_t& JMATH::JModel_t::negate ( )
inline

Negate model.

Returns
this model

Definition at line 94 of file JMath/JModel.hh.

95  {
96  for (size_t i = 0; i != this->size(); ++i) {
97  (*this)[i] = -(*this)[i];
98  }
99 
100  return *this;
101  }
JModel_t& JMATH::JModel_t::add ( const JModel_t model)
inline

Add model.

Parameters
modelmodel
Returns
this model

Definition at line 110 of file JMath/JModel.hh.

111  {
112  for (size_t i = 0; i != model.size(); ++i) {
113  (*this)[i] += model[i];
114  }
115 
116  return *this;
117  }
JModel_t& JMATH::JModel_t::sub ( const JModel_t model)
inline

Subtract model.

Parameters
modelmodel
Returns
this model

Definition at line 126 of file JMath/JModel.hh.

127  {
128  for (size_t i = 0; i != model.size(); ++i) {
129  (*this)[i] -= model[i];
130  }
131 
132  return *this;
133  }
JModel_t& JMATH::JModel_t::mul ( const double  factor)
inline

Scale model.

Parameters
factormultiplication factor
Returns
this model

Definition at line 142 of file JMath/JModel.hh.

143  {
144  for (size_t i = 0; i != this->size(); ++i) {
145  (*this)[i] *= factor;
146  }
147 
148  return *this;
149  }
JModel_t& JMATH::JModel_t::div ( const double  factor)
inline

Scale model.

Parameters
factordivision factor
Returns
this model

Definition at line 158 of file JMath/JModel.hh.

159  {
160  for (size_t i = 0; i != this->size(); ++i) {
161  (*this)[i] /= factor;
162  }
163 
164  return *this;
165  }
JModel_t & JMATH::JMath< JModel_t , JNullType >::mul ( const JNullType 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 Function Documentation

std::istream& operator>> ( std::istream &  in,
JModel_t model 
)
friend

Write model to input stream.

Parameters
ininput stream
modelmodel
Returns
input stream

Definition at line 175 of file JMath/JModel.hh.

176  {
177  model.clear();
178 
179  for (double value; in >> value; ) {
180  model.push_back(value);
181  }
182 
183  return in;
184  }
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 JModel_t model 
)
friend

Write model to output stream.

Parameters
outoutput stream
modelmodel
Returns
output stream

Definition at line 194 of file JMath/JModel.hh.

195  {
196  using namespace std;
197 
198  for (JModel_t::const_iterator i = model.begin(); i != model.end(); ++i) {
199  out << FIXED(7,3) << *i << ' ';
200  }
201 
202  return out;
203  }
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446

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