CppAD: A C++ Algorithmic Differentiation Package
20130918
|
00001 /* $Id$ */ 00002 # ifndef CPPAD_ORDERED_INCLUDED 00003 # define CPPAD_ORDERED_INCLUDED 00004 00005 /* -------------------------------------------------------------------------- 00006 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell 00007 00008 CppAD is distributed under multiple licenses. This distribution is under 00009 the terms of the 00010 Eclipse Public License Version 1.0. 00011 00012 A copy of this license is included in the COPYING file of this distribution. 00013 Please visit http://www.coin-or.org/CppAD/ for information on other licenses. 00014 -------------------------------------------------------------------------- */ 00015 00016 # include <cppad/local/define.hpp> 00017 00018 namespace CppAD { // BEGIN_CPPAD_NAMESPACE 00019 00020 /*! 00021 \file ordered.hpp 00022 Check and AD values ordering properties relative to zero. 00023 */ 00024 00025 // GreaterThanZero ============================================================ 00026 /*! 00027 Check if an AD<Base> is greater than zero. 00028 00029 \param x 00030 value we are checking. 00031 00032 \return 00033 returns true iff the \c x is greater than zero. 00034 */ 00035 template <class Base> 00036 CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION 00037 bool GreaterThanZero(const AD<Base> &x) 00038 { return GreaterThanZero(x.value_); } 00039 // GreaterThanOrZero ========================================================= 00040 /*! 00041 Check if an AD<Base> is greater than or equal zero. 00042 00043 \param x 00044 value we are checking. 00045 00046 \return 00047 returns true iff the \c x is greater than or equal zero. 00048 */ 00049 template <class Base> 00050 CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION 00051 bool GreaterThanOrZero(const AD<Base> &x) 00052 { return GreaterThanOrZero(x.value_); } 00053 // LessThanZero ============================================================ 00054 /*! 00055 Check if an AD<Base> is less than zero. 00056 00057 \param x 00058 value we are checking. 00059 00060 \return 00061 returns true iff the \c x is less than zero. 00062 */ 00063 template <class Base> 00064 CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION 00065 bool LessThanZero(const AD<Base> &x) 00066 { return LessThanZero(x.value_); } 00067 // LessThanOrZero ========================================================= 00068 /*! 00069 Check if an AD<Base> is less than or equal zero. 00070 00071 \param x 00072 value we are checking. 00073 00074 \return 00075 returns true iff the \c x is less than or equal zero. 00076 */ 00077 template <class Base> 00078 CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION 00079 bool LessThanOrZero(const AD<Base> &x) 00080 { return LessThanOrZero(x.value_); } 00081 // abs_geq ========================================================= 00082 /*! 00083 Check if absolute value of one AD<Base> is greater or equal another. 00084 00085 \param x 00086 value we are checking if it is greater than or equal other. 00087 00088 \param y 00089 value we are checking if it is less than other. 00090 00091 \return 00092 returns true iff the absolute value of \c x is greater than or equal 00093 absolute value of \c y. 00094 */ 00095 template <class Base> 00096 CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION 00097 bool abs_geq(const AD<Base>& x, const AD<Base>& y) 00098 { return abs_geq(x.value_, y.value_); } 00099 // ============================================================================ 00100 } // END_CPPAD_NAMESPACE 00101 # endif 00102