Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
double & operator[] (const size_t index)
 Get value at given index.
 
bool equals (const JModel_t &model, const double eps=std::numeric_limits< double >::min()) const
 Equality.
 
JModel_tnegate ()
 Negate model.
 
JModel_tadd (const JModel_t &model)
 Add model.
 
JModel_tsub (const JModel_t &model)
 Subtract model.
 
JModel_tmul (const double factor)
 Scale model.
 
JModel_tdiv (const double factor)
 Scale model.
 
JModel_tmul (const JSecond_t &object)
 Multiply with object.
 

Friends

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

Detailed Description

Fit model.

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

Member Typedef Documentation

◆ parameter_type

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

Member Function Documentation

◆ operator=()

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 }

◆ operator[]()

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
66 }

◆ equals()

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 }

◆ negate()

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 }

◆ add()

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 }

◆ sub()

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 }

◆ mul() [1/2]

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 }

◆ div()

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 }

◆ mul() [2/2]

JModel_t & JMATH::JMath< JModel_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,
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 }

◆ operator<<

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:448

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