\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
valvector_base_require¶
View page sourceThe valvector Implementation of CppAD Base Type Requirements¶
Output Operator¶
The Output Operator requirement is satisfied by valvector_output .
Constructors¶
The Constructors requirements are satisfied by valvector_ctor .
Unary Operators¶
The Unary Operators requirements are satisfied by valvector_unary_op .
Assignment Operators¶
The Assignment Operators requirements are satisfied by valvector_assign and valvector_compound_op .
Binary Operators¶
The Binary Operators requirements are satisfied by valvector_binary_op .
Bool Operators¶
The Bool Operators requirements are satisfied by valvector_compare_op .
Conditional Expressions¶
The base_cond_exp requirements are satisfied by valvector_condexp .
Standard Math¶
The base_std_math requirements are satisfied by valvector_unary_math and valvector_pow .
azmul¶
The Absolute Zero, azmul requirement is satisfied by valvector_azmul .
Features Implemented Here¶
Integer¶
The Integer requirement is satisfied by:
namespace CppAD {
inline int Integer(const valvector& x) { return int( x[0] ); }
}
numeric_limits¶
The base_limits requirement is satisfied by:
namespace CppAD {
CPPAD_NUMERIC_LIMITS(valvector::scalar_type, valvector)
}
to_string¶
The base_to_string requirement is satisfied by:
namespace CppAD {
CPPAD_TO_STRING(valvector)
}
EqualOpSeq¶
The EqualOpSeq requirement is satisfied by:
namespace CppAD {
inline bool EqualOpSeq(const valvector& left, const valvector& right)
{ return left == right; }
}
Identical¶
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; }
}
Not Ordered¶
The Not Ordered requirement is satisfied by:
# define CPPAD_VALVECTOR_NOT_AVAILABLE(fun) \
inline bool fun(const valvector& x) \
{ CPPAD_VALVECTOR_ASSERT_KNOWN( false, #fun " is not available" ) \
return false; \
}
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;
}
}
Example¶
The file valvector_base_require.cpp is an example and test of the valvector Features Implemented Here .