Home
Install
Use
Develop
Support
News
Credits
hosted by
|
14 #include "PromoteTraits.h"
23 template < typename T, typename U=T> class MeanRadian;
32 template < typename T, typename U=T>
50 template < typename V, typename W>
54 template < typename V, typename W>
58 template < typename V, typename W>
143 #if COMPLEX_SPECIALIZE
144 friend const std::complex<Estimate> operator * ( const std::complex<Estimate>& a, const std::complex<Estimate>& b)
146 return std::complex<Estimate> (
147 a.real()*b.real() - a.imag()*b.imag(),
148 a.real()*b.imag() + a.imag()*b.real()
152 friend const Estimate norm ( const std::complex<Estimate>& u)
153 { return u.real()*u.real() + u.imag()*u.imag(); }
188 { T c2 = c.val*c.val; T s2 = s. val*s. val; T sc2 = c2+s2;
204 friend int myfinite ( const Estimate& u)
205 { return myfinite (u. val); }
207 friend int isinf ( const Estimate& u)
208 { return isinf (u. val); }
210 friend int isnan ( const Estimate& u)
211 { return isnan (u. val); }
213 friend const T abs ( const Estimate& u)
214 { return std::abs (u. val); }
225 static inline unsigned ndim () { return 1; }
228 static inline const T& element ( const Estimate<T,U>& t, unsigned)
232 template < class T, class U, class V, class W>
237 typename PromoteTraits<U,W>::promote_type > promote_type;
240 template < class T, class U, class V>
241 class PromoteTraits< Estimate<T,U>, V >
247 template < class T, class U, class V>
248 class PromoteTraits< V, Estimate<T,U> >
256 template < class T, class U>
257 struct numeric_limits< Estimate<T,U> >
258 : public numeric_limits<T> { };
262 template< typename T, typename U>
263 std::ostream& operator<< (std::ostream& ostr, const Estimate<T,U>& estimate)
265 return ostr << "(" << estimate. val << "+-" << sqrt(estimate. var) << ")";
268 static inline bool expect (std::istream& is, char c)
270 if (is.peek() != c) {
271 is.setstate (std::ios::failbit);
278 template< typename T, typename U>
279 std::istream& operator >> (std::istream& is, Estimate<T,U>& estimate)
285 if (open_brace != '(') {
293 if (!expect(is, '+'))
295 if (!expect(is, '-'))
303 if (!expect(is, ')'))
320 template < typename T, typename U>
363 template< typename T, typename U>
366 return ostr << mean.get_Estimate();
372 template < typename T, typename U>
387 { cosine = mean.cosine; sine = mean.sine; return * this; }
395 { cosine = cos(d); sine = sin(d); return * this; }
403 { cosine += cos(d); sine += sin(d); return * this; }
407 return atan2 ( sine.get_Estimate(), cosine.get_Estimate()); }
410 { return sine.get_Estimate(); }
413 { return cosine.get_Estimate(); }
425 template< typename T, typename U>
426 std::ostream& operator<< (std::ostream& ostr, const MeanRadian<T,U>& mean)
428 return ostr << mean.get_Estimate();
const MeanEstimate & operator+=(const MeanEstimate &d)
friend const friend Estimate sin(const Estimate &u)
friend const friend Estimate cosh(const Estimate &u)
friend const friend Estimate sinh(const Estimate &u)
MeanEstimate(T _val=0, U _var=0)
Calculates the mean of a value in radians. Definition: Estimate.h:23
friend const friend Estimate exp(const Estimate &u)
friend const friend Estimate cos(const Estimate &u)
const Estimate & operator+=(const Estimate &d)
bool operator==(T _norm_val) const
T val The value, . Definition: Estimate.h:42
const Estimate & operator*=(const Estimate &d)
friend const friend Estimate acos(const Estimate &u)
bool operator<(const Estimate &d) const
void set_error(const U &u)
U var The variance of the value, . Definition: Estimate.h:44
bool operator==(const Estimate &d) const
T norm_val The value, normalized by its variance. Definition: Estimate.h:325
const Estimate & operator=(const Estimate &d)
MeanEstimate< T, U > sine The average sine. Definition: Estimate.h:420
friend const friend Estimate log(const Estimate &u)
U inv_var The inverse of its variance. Definition: Estimate.h:327
void set_value(const T &t)
friend const friend Estimate atan2(const Estimate &s, const Estimate &c)
Definition: Estimate.h:22
bool operator!=(const Estimate &d) const
friend const friend Estimate atan(const Estimate &u)
E element_traits Traits of the elements of the data type. Definition: Traits.h:73
const Estimate & operator-=(const Estimate &d)
friend const friend Estimate sqrt(const Estimate &u)
Estimate(T _val=0, U _var=0)
friend const friend Estimate operator-(Estimate a)
bool operator>(const Estimate &d) const
const Estimate & operator/=(const Estimate &d)
MeanEstimate< T, U > cosine The average cosine. Definition: Estimate.h:417
const MeanRadian & operator+=(const MeanRadian &d)
const Estimate inverse() const
const MeanEstimate & operator=(const MeanEstimate &d)
friend const friend Estimate atanh(const Estimate &u)
const MeanRadian & operator=(const MeanRadian &mean)
Traits of the data type. Definition: Traits.h:70
void set_variance(const U &u)
Generated using doxygen 1.8.17
|