Home
Install
Use
Develop
Support
News
Credits
hosted by
|
14#include "PromoteTraits.h"
24template < typename T, typename U=T> class MeanRadian;
33template < typename T, typename U=T>
51 template < typename V, typename W>
55 template < typename V, typename W>
59 template < typename V, typename W>
144#if COMPLEX_SPECIALIZE
145 friend const std::complex<Estimate> operator * ( const std::complex<Estimate>& a, const std::complex<Estimate>& b)
147 return std::complex<Estimate> (
148 a.real()*b.real() - a.imag()*b.imag(),
149 a.real()*b.imag() + a.imag()*b.real()
153 friend const Estimate norm ( const std::complex<Estimate>& u)
154 { return u.real()*u.real() + u.imag()*u.imag(); }
189 { T c2 = c.val*c.val; T s2 = s. val*s. val; T sc2 = c2+s2;
205 friend int finite ( const Estimate& u)
206 { return true_math::finite (u. val); }
208 friend int isinf ( const Estimate& u)
209 { return isinf (u. val); }
211 friend int isnan ( const Estimate& u)
212 { return isnan (u. val); }
214 friend const T abs ( const Estimate& u)
215 { return std::abs (u. val); }
226 static inline unsigned ndim () { return 1; }
227 static inline T& element (Estimate<T,U>& t, unsigned)
229 static inline const T& element ( const Estimate<T,U>& t, unsigned)
233template < class T, class U, class V, class W>
237 typedef Estimate< typename PromoteTraits<T,V>::promote_type,
238 typename PromoteTraits<U,W>::promote_type > promote_type;
241template < class T, class U, class V>
242class PromoteTraits< Estimate<T,U>, V >
245 typedef Estimate<typename PromoteTraits<T,V>::promote_type,U> promote_type;
248template < class T, class U, class V>
249class PromoteTraits< V, Estimate<T,U> >
252 typedef Estimate<typename PromoteTraits<T,V>::promote_type,U> promote_type;
257 template < class T, class U>
258 struct numeric_limits< Estimate<T,U> >
259 : public numeric_limits<T> { };
263template< typename T, typename U>
264std::ostream& operator<< (std::ostream& ostr, const Estimate<T,U>& estimate)
266 return ostr << "(" << estimate. val << "+-" << sqrt(estimate. var) << ")";
269static inline bool expect (std::istream& is, char c)
271 if (is.peek() != c) {
272 is.setstate (std::ios::failbit);
279template< typename T, typename U>
280std::istream& operator >> (std::istream& is, Estimate<T,U>& estimate)
286 if (open_brace != '(') {
294 if (!expect(is, '+'))
296 if (!expect(is, '-'))
304 if (!expect(is, ')'))
321template < typename T, typename U>
357 Estimate<T,U> get_Estimate () const
359 return Estimate<T,U> ( norm_val*var, var); }
364template< typename T, typename U>
367 return ostr << mean.get_Estimate();
373template < typename T, typename U>
388 { cosine = mean.cosine; sine = mean.sine; return * this; }
396 { cosine = cos(d); sine = sin(d); return * this; }
404 { cosine += cos(d); sine += sin(d); return * this; }
406 Estimate<T,U> get_Estimate () const
407 { if ( sine.norm_val==0 && cosine.norm_val==0) return Estimate<T,U>(0,0);
408 return atan2 ( sine.get_Estimate(), cosine.get_Estimate()); }
410 Estimate<T,U> get_sin () const
411 { return sine.get_Estimate(); }
413 Estimate<T,U> get_cos () const
414 { return cosine.get_Estimate(); }
421 MeanEstimate<T,U> sine;
426template< typename T, typename U>
427std::ostream& operator<< (std::ostream& ostr, const MeanRadian<T,U>& mean)
429 return ostr << mean.get_Estimate();
bool operator<(const Estimate &d) const
friend friend const Estimate cos(const Estimate &u)
bool operator>(const Estimate &d) const
friend friend const Estimate cosh(const Estimate &u)
T val Definition Estimate.h:43
void set_value(const T &t)
friend friend const Estimate atan(const Estimate &u)
friend friend const Estimate log(const Estimate &u)
bool operator!=(const Estimate &d) const
const Estimate & operator/=(const Estimate &d)
bool operator==(const Estimate &d) const
friend friend const Estimate atanh(const Estimate &u)
U var Definition Estimate.h:45
const Estimate & operator=(const Estimate &d)
const Estimate & operator+=(const Estimate &d)
Estimate(T _val=0, U _var=0)
friend friend const Estimate sqrt(const Estimate &u)
friend friend const Estimate atan2(const Estimate &s, const Estimate &c)
const Estimate & operator*=(const Estimate &d)
friend friend const Estimate operator-(Estimate a)
friend friend const Estimate sinh(const Estimate &u)
const Estimate & operator-=(const Estimate &d)
friend friend const Estimate acos(const Estimate &u)
friend friend const Estimate sin(const Estimate &u)
void set_error(const U &u)
const Estimate inverse() const
void set_variance(const U &u)
friend friend const Estimate exp(const Estimate &u)
const MeanEstimate & operator+=(const MeanEstimate &d)
const MeanEstimate & operator=(const MeanEstimate &d)
T norm_val Definition Estimate.h:326
bool operator==(T _norm_val) const
U inv_var Definition Estimate.h:328
MeanEstimate(T _val=0, U _var=0)
const MeanRadian & operator=(const MeanRadian &mean)
MeanEstimate< T, U > sine Definition Estimate.h:421
MeanEstimate< T, U > cosine Definition Estimate.h:418
const MeanRadian & operator+=(const MeanRadian &d)
E element_traits Definition Traits.h:73
Generated using doxygen 1.14.0
|