------------------------------------------------------------------ lines 1049-1194 of file: include/cppad/example/valvector/class.hpp ------------------------------------------------------------------ {xrst_begin valvector_base_require} {xrst_spell geq } The valvector Implementation of CppAD Base Type Requirements ############################################################ Output Operator *************** The :ref:`base_require@Output Operator` requirement is satisfied by :ref:`valvector_output-name` . Constructors ************ The :ref:`base_member@Constructors` requirements are satisfied by :ref:`valvector_ctor-name` . Unary Operators *************** The :ref:`base_member@Unary Operators` requirements are satisfied by :ref:`valvector_unary_op-name` . Assignment Operators ******************** The :ref:`base_member@Assignment Operators` requirements are satisfied by :ref:`valvector_assign-name` and :ref:`valvector_compound_op-name` . Binary Operators **************** The :ref:`base_member@Binary Operators` requirements are satisfied by :ref:`valvector_binary_op-name` . Bool Operators ************** The :ref:`base_member@Bool Operators` requirements are satisfied by :ref:`valvector_compare_op-name` . Conditional Expressions *********************** The :ref:`base_cond_exp-name` requirements are satisfied by :ref:`valvector_condexp-name` . Standard Math ************* The :ref:`base_std_math-name` requirements are satisfied by :ref:`valvector_unary_math-name` and :ref:`valvector_pow-name` . azmul ***** The :ref:`base_require@Absolute Zero, azmul` requirement is satisfied by :ref:`valvector_azmul-name` . Features Implemented Here ************************* Integer ======= The :ref:`base_require@Integer` requirement is satisfied by: {xrst_code hpp} */ namespace CppAD { inline int Integer(const valvector& x) { return int( x[0] ); } } /* {xrst_code} numeric_limits ============== The :ref:`base_limits-name` requirement is satisfied by: {xrst_code hpp} */ namespace CppAD { CPPAD_NUMERIC_LIMITS(valvector::scalar_type, valvector) } /* {xrst_code} to_string ========= The :ref:`base_to_string-name` requirement is satisfied by: {xrst_code hpp} */ namespace CppAD { CPPAD_TO_STRING(valvector) } /* {xrst_code} EqualOpSeq ========== The :ref:`base_identical@EqualOpSeq` requirement is satisfied by: {xrst_code hpp} */ namespace CppAD { inline bool EqualOpSeq(const valvector& left, const valvector& right) { return left == right; } } /* {xrst_code} Identical ========= {xrst_code hpp} */ namespace CppAD { inline bool IdenticalCon(const valvector& x) { return true; } inline bool IdenticalZero(const valvector& x) { return x == valvector(0); } inline bool IdenticalOne(const valvector& x) { return x == valvector(1); } inline bool IdenticalEqualCon(const valvector& x, const valvector& y) { return x == y; } } /* {xrst_code} Not Ordered =========== The :ref:`base_ordered@Not Ordered` requirement is satisfied by: {xrst_literal , // BEGIN_NOT_AVAILABLE , // END_NOT_AVAILABLE } {xrst_code hpp} */ namespace CppAD { CPPAD_VALVECTOR_NOT_AVAILABLE(GreaterThanZero) CPPAD_VALVECTOR_NOT_AVAILABLE(GreaterThanOrZero) CPPAD_VALVECTOR_NOT_AVAILABLE(LessThanZero) CPPAD_VALVECTOR_NOT_AVAILABLE(LessThanOrZero) // // abs_geq inline bool abs_geq(const valvector& x, const valvector& y) { CPPAD_VALVECTOR_ASSERT_KNOWN( x.size() == 1 || y.size() == 1 || x.size() == y.size() , "size error in abs_geq functions" ) size_t max_size = std::max( x.size(), y.size() ); valvector::scalar_type abs_x(0), abs_y(0); for(size_t i = 0; i < max_size; ++i) { abs_x += fabs( x[i] ); abs_y += fabs( y[i] ); } return abs_x >= abs_y; } } /* {xrst_code} {xrst_toc_hidden example/valvector/base_require.cpp } Example ======= The file :ref:`valvector_base_require.cpp-name` is an example and test of the valvector :ref:`valvector_base_require@Features Implemented Here` . {xrst_end valvector_base_require}