oln::math Namespace Reference

Useful functions. More...


Classes

struct  f_sqr
 Square fctor. More...
struct  f_abs
 Absolute value fctor. More...

Namespaces

namespace  internal
 Internal purpose only.

Functions

template<class T>
const T sqr (const T &val)
 Square function.
template<class T>
const T abs (const T &val)
 Absolute value function.
template<typename DestValue, typename I, typename J>
DestValue dot_product (const I &i, const J &j)
 Dot product.


Detailed Description

Useful functions.

Todo:
FIXME: I'm not proud of the code below think it could be better...
Todo:
FIXME: this code sounds really odd. Why does the operator() take value<Self> instead of Self directly ? FIXME: Self should be renamed into Exact.


Function Documentation

template<typename DestValue, typename I, typename J>
DestValue oln::math::dot_product ( const I &  i,
const J &  j 
)

Dot product.

 #include <oln/math/macros.hh>
 #include <ntg/all.hh>
 int main()
 {
   ntg::int_u8 i(3), j(4);
   // Print "12"
   std::cout << oln::math::dot_product<ntg::float_s>(i, j) << std::endl;

   ntg::rgb_8 blue(0, 0, 200), yellow(0, 30, 10);
   // Print "2000"
   std::cout << oln::math::dot_product<ntg::float_s>(blue, yellow)
             << std::endl;
 }

Definition at line 142 of file olena/oln/math/macros.hh.

00143     {
00144       typedef typename mlc::if_<ntg_is_a(I, ntg::vectorial)::ret,
00145         internal::f_dot_product_v<DestValue, I, J>,
00146         internal::f_dot_product_nv<DestValue, I, J> >::ret fctor;
00147       return fctor::product(i, j);
00148     }


Generated on Tue Feb 20 20:28:00 2007 for Olena by  doxygen 1.5.1