Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75176 - sandbox/multiprecision/libs/multiprecision/example
From: e_float_at_[hidden]
Date: 2011-10-30 06:02:18


Author: christopher_kormanyos
Date: 2011-10-30 06:02:16 EDT (Sun, 30 Oct 2011)
New Revision: 75176
URL: http://svn.boost.org/trac/boost/changeset/75176

Log:
- Cleaned up the new polynomial example 10.
Text files modified:
   sandbox/multiprecision/libs/multiprecision/example/example_010_orthogonal_polynomials.cpp | 39 ++++++++++++++++++++-------------------
   1 files changed, 20 insertions(+), 19 deletions(-)

Modified: sandbox/multiprecision/libs/multiprecision/example/example_010_orthogonal_polynomials.cpp
==============================================================================
--- sandbox/multiprecision/libs/multiprecision/example/example_010_orthogonal_polynomials.cpp (original)
+++ sandbox/multiprecision/libs/multiprecision/example/example_010_orthogonal_polynomials.cpp 2011-10-30 06:02:16 EDT (Sun, 30 Oct 2011)
@@ -20,35 +20,36 @@
   {
     static const T& value(void)
     {
- static const T t(N);
- return t;
+ static const T the_value(N);
+ return the_value;
     }
   };
 
- inline std::complex<double> operator+(const boost::int32_t n, const std::complex<double>& x) { return std::complex<double>(x.real() + n, x.imag()); }
- inline std::complex<double> operator-(const boost::int32_t n, const std::complex<double>& x) { return std::complex<double>(n - x.real(), x.imag()); }
- inline std::complex<double> operator*(const boost::int32_t n, const std::complex<double>& x) { return std::complex<double>(x.real() * n, x.imag() * n); }
- inline std::complex<double> operator/(const boost::int32_t n, const std::complex<double>& x) { return std::complex<double>(x.real() * n, -x.imag() * n) / ((x.real() * x.real()) + (x.imag() * x.imag())); }
-
- inline std::complex<double> operator+(const std::complex<double>& x, const boost::int32_t n) { return std::complex<double>(x.real() + n, x.imag()); }
- inline std::complex<double> operator-(const std::complex<double>& x, const boost::int32_t n) { return std::complex<double>(x.real() - n, x.imag()); }
- inline std::complex<double> operator*(const std::complex<double>& x, const boost::int32_t n) { return std::complex<double>(x.real() * n, x.imag() * n); }
- inline std::complex<double> operator/(const std::complex<double>& x, const boost::int32_t n) { return std::complex<double>(x.real() / n, x.imag() / n); }
+ std::complex<double> operator+(const boost::int32_t n, const std::complex<double>& x) { return std::complex<double>(n + x.real(), x.imag()); }
+ std::complex<double> operator-(const boost::int32_t n, const std::complex<double>& x) { return std::complex<double>(n - x.real(), x.imag()); }
+ std::complex<double> operator*(const boost::int32_t n, const std::complex<double>& x) { return std::complex<double>(n * x.real(), n * x.imag()); }
+ std::complex<double> operator/(const boost::int32_t n, const std::complex<double>& x) { return std::complex<double>(n * x.real(), -n * x.imag()) / std::norm(x); }
+
+ std::complex<double> operator+(const std::complex<double>& x, const boost::int32_t n) { return std::complex<double>(x.real() + n, x.imag()); }
+ std::complex<double> operator-(const std::complex<double>& x, const boost::int32_t n) { return std::complex<double>(x.real() - n, x.imag()); }
+ std::complex<double> operator*(const std::complex<double>& x, const boost::int32_t n) { return std::complex<double>(x.real() * n, x.imag() * n); }
+ std::complex<double> operator/(const std::complex<double>& x, const boost::int32_t n) { return std::complex<double>(x.real() / n, x.imag() / n); }
 
   typedef enum enum_orthogonal_polynomial_type
   {
- orthogonal_polynomial_type_chebyshev_t = 1,
- orthogonal_polynomial_type_chebyshev_u = 2,
- orthogonal_polynomial_type_laguerre_l = 3,
- orthogonal_polynomial_type_hermite_h = 4
+ orthogonal_polynomial_type_undefined,
+ orthogonal_polynomial_type_chebyshev_t,
+ orthogonal_polynomial_type_chebyshev_u,
+ orthogonal_polynomial_type_laguerre_l,
+ orthogonal_polynomial_type_hermite_h
   }
   orthogonal_polynomial_type;
 
   template<typename T>
- static inline void orthogonal_polynomial_template(const T& x,
- const boost::uint32_t n,
- const orthogonal_polynomial_type polynomial_type,
- std::vector<T>& results)
+ void orthogonal_polynomial_template(const T& x,
+ const boost::uint32_t n,
+ const orthogonal_polynomial_type polynomial_type,
+ std::vector<T>& results)
   {
     // Compute the value of an orthogonal polynomial of one of the following types:
     // Chebyshev 1st, Chebyshev 2nd, Laguerre, or Hermite


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk