diff --git a/include/cppad/local/sweep/forward0.hpp b/include/cppad/local/sweep/forward0.hpp index 90f9de114..f88c71a31 100644 --- a/include/cppad/local/sweep/forward0.hpp +++ b/include/cppad/local/sweep/forward0.hpp @@ -310,6 +310,27 @@ void forward0( // action to take depends on the case switch( op ) { + case EqppOp: + case EqpvOp: + case EqvvOp: + case LeppOp: + case LepvOp: + case LevpOp: + case LevvOp: + case LtppOp: + case LtpvOp: + case LtvpOp: + case LtvvOp: + case NeppOp: + case NepvOp: + case NevvOp: + var_op::compare(op, + arg, parameter, J, taylor, itr.op_index(), compare_change_count, + compare_change_number, compare_change_op_index + ); + break; + // ------------------------------------------------- + case AbsOp: var_op::forward_abs_op_0(i_var, size_t(arg[0]), J, taylor); break; @@ -435,30 +456,6 @@ void forward0( break; // ------------------------------------------------- - case EqppOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case EqpvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case EqvvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - case ErfOp: case ErfcOp: var_op::forward_erf_op_0(op, i_var, arg, parameter, J, taylor); @@ -510,37 +507,6 @@ void forward0( break; // ------------------------------------------------- - case LeppOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - case LepvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case LevpOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case LevvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - case LogOp: var_op::forward_log_op_0(i_var, size_t(arg[0]), J, taylor); break; @@ -551,37 +517,6 @@ void forward0( break; // ------------------------------------------------- - case LtppOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - case LtpvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case LtvpOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case LtvvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - case MulpvOp: CPPAD_ASSERT_UNKNOWN( size_t(arg[0]) < num_par ); var_op::forward_mulpv_op_0(i_var, arg, parameter, J, taylor); @@ -593,36 +528,12 @@ void forward0( break; // ------------------------------------------------- - case NeppOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - case NegOp: var_op::forward_neg_op_0(i_var, size_t(arg[0]), J, taylor); break; // ------------------------------------------------- - case NepvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case NevvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - case ParOp: var_op::forward_par_op_0( i_var, arg, num_par, parameter, J, taylor diff --git a/include/cppad/local/sweep/forward1.hpp b/include/cppad/local/sweep/forward1.hpp index 24d5df657..55810c418 100644 --- a/include/cppad/local/sweep/forward1.hpp +++ b/include/cppad/local/sweep/forward1.hpp @@ -315,6 +315,27 @@ void forward1( // action depends on the operator switch( op ) { + case EqppOp: + case EqpvOp: + case EqvvOp: + case LeppOp: + case LepvOp: + case LevpOp: + case LevvOp: + case LtppOp: + case LtpvOp: + case LtvpOp: + case LtvvOp: + case NeppOp: + case NepvOp: + case NevvOp: + var_op::compare(op, + arg, parameter, J, taylor, itr.op_index(), compare_change_count, + compare_change_number, compare_change_op_index + ); + break; + // ------------------------------------------------- + case AbsOp: var_op::forward_abs_op(p, q, i_var, size_t(arg[0]), J, taylor); break; @@ -440,30 +461,6 @@ void forward1( break; // ------------------------------------------------- - case EqppOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case EqpvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case EqvvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - case ErfOp: case ErfcOp: var_op::forward_erf_op(op, p, q, i_var, arg, parameter, J, taylor); @@ -569,38 +566,6 @@ void forward1( break; // ------------------------------------------------- - case LeppOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case LepvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case LevpOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case LevvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - case LogOp: var_op::forward_log_op(p, q, i_var, size_t(arg[0]), J, taylor); break; @@ -611,38 +576,6 @@ void forward1( break; // ------------------------------------------------- - case LtppOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case LtpvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case LtvpOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case LtvvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - case MulpvOp: CPPAD_ASSERT_UNKNOWN( size_t(arg[0]) < num_par ); var_op::forward_mulpv_op(p, q, i_var, arg, parameter, J, taylor); @@ -659,30 +592,6 @@ void forward1( break; // ------------------------------------------------- - case NeppOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case NepvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - - case NevvOp: - var_op::compare(op, - arg, parameter, J, taylor, itr.op_index(), compare_change_count, - compare_change_number, compare_change_op_index - ); - break; - // ------------------------------------------------- - case ParOp: i = p; if( i == 0 ) diff --git a/include/cppad/local/var_op/comp_op.hpp b/include/cppad/local/var_op/comp_op.hpp deleted file mode 100644 index 3ecd09258..000000000 --- a/include/cppad/local/var_op/comp_op.hpp +++ /dev/null @@ -1,413 +0,0 @@ -# ifndef CPPAD_LOCAL_VAR_OP_COMP_OP_HPP -# define CPPAD_LOCAL_VAR_OP_COMP_OP_HPP -// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later -// SPDX-FileCopyrightText: Bradley M. Bell -// SPDX-FileContributor: 2003-24 Bradley M. Bell -// ---------------------------------------------------------------------------- - - -namespace CppAD { namespace local { namespace var_op { -/*! -\file comp_op.hpp -Zero order forward mode check how many comparisons changed. -*/ - -// -------------------------------- <= ----------------------------------- -/*! -Zero order forward mode comparison check that left <= right - -\param count -It the condition is not true, ths counter is incremented by one. - -\param arg -parameter[ arg[0] ] is the left operand and -parameter[ arg[1] ] is the right operand. - -\param parameter -vector of parameter values. -*/ -template -inline void forward_lepp_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(LeppOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(LeppOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base x = parameter[ arg[0] ]; - Base y = parameter[ arg[1] ]; - - count += size_t( GreaterThanZero(x - y) ); -} -/*! -Zero order forward mode comparison check that left <= right - -\param count -It the condition is not true, ths counter is incremented by one. - -\param arg -parameter[ arg[0] ] is the left operand and -taylor[ size_t(arg[1]) * cap_order + 0 ] is the zero order Taylor coefficient -for the right operand. - -\param parameter -vector of parameter values. - -\param cap_order -number of Taylor coefficients allocated for each variable - -\param taylor -vector of taylor coefficients. -*/ -template -inline void forward_lepv_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter , - size_t cap_order , - Base* taylor ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(LepvOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(LepvOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base x = parameter[ arg[0] ]; - Base* y = taylor + size_t(arg[1]) * cap_order; - - count += GreaterThanZero(x - y[0]); -} -/*! -Zero order forward mode comparison check that left <= right - -\param count -It the condition is not true, ths counter is incremented by one. - -\param arg -taylor[ size_t(arg[0]) * cap_order + 0 ] is the zero order Taylor coefficient -for the left operand and parameter[ arg[1] ] is the right operand - -\param parameter -vector of parameter values. - -\param cap_order -number of Taylor coefficients allocated for each variable - -\param taylor -vector of taylor coefficients. -*/ -template -inline void forward_levp_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter , - size_t cap_order , - Base* taylor ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(LevpOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(LevpOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base* x = taylor + size_t(arg[0]) * cap_order; - Base y = parameter[ arg[1] ]; - - count += GreaterThanZero(x[0] - y); -} -/*! -Zero order forward mode comparison check that left <= right - -\param count -It the condition is not true, ths counter is incremented by one. - -\param arg -taylor[ size_t(arg[0]) * cap_order + 0 ] is the zero order Taylor coefficient -for the left operand and -taylor[ size_t(arg[1]) * cap_order + 0 ] is the zero order Taylor coefficient -for the right operand. - -\param parameter -vector of parameter values. - -\param cap_order -number of Taylor coefficients allocated for each variable - -\param taylor -vector of taylor coefficients. -*/ -template -inline void forward_levv_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter , - size_t cap_order , - Base* taylor ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(LevvOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(LevvOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base* x = taylor + size_t(arg[0]) * cap_order; - Base* y = taylor + size_t(arg[1]) * cap_order; - - count += GreaterThanZero(x[0] - y[0]); -} -// ------------------------------- < ------------------------------------- -/*! -Zero order forward mode comparison check that left < right - -\param count -It the condition is not true, ths counter is incremented by one. - -\param arg -parameter[ arg[0] ] is the left operand and -parameter[ arg[1] ] is the right operand. - -\param parameter -vector of parameter values. -*/ -template -inline void forward_ltpp_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(LtppOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(LtppOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base x = parameter[ arg[0] ]; - Base y = parameter[ arg[1] ]; - - count += GreaterThanOrZero(x - y); -} -/*! -Zero order forward mode comparison check that left < right - -\copydetails CppAD::local::forward_lepv_op_0 -*/ -template -inline void forward_ltpv_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter , - size_t cap_order , - Base* taylor ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(LtpvOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(LtpvOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base x = parameter[ arg[0] ]; - Base* y = taylor + size_t(arg[1]) * cap_order; - - count += GreaterThanOrZero(x - y[0]); -} -/*! -Zero order forward mode comparison check that left < right - -\copydetails CppAD::local::forward_levp_op_0 -*/ -template -inline void forward_ltvp_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter , - size_t cap_order , - Base* taylor ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(LtvpOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(LtvpOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base* x = taylor + size_t(arg[0]) * cap_order; - Base y = parameter[ arg[1] ]; - - count += GreaterThanOrZero(x[0] - y); -} -/*! -Zero order forward mode comparison check that left < right - -\copydetails CppAD::local::forward_levv_op_0 -*/ -template -inline void forward_ltvv_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter , - size_t cap_order , - Base* taylor ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(LtvvOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(LtvvOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base* x = taylor + size_t(arg[0]) * cap_order; - Base* y = taylor + size_t(arg[1]) * cap_order; - - count += GreaterThanOrZero(x[0] - y[0]); -} -// ------------------------------ == ------------------------------------- -/*! -Zero order forward mode comparison check that left == right - -\param count -It the condition is not true, ths counter is incremented by one. - -\param arg -parameter[ arg[0] ] is the left operand and -parameter[ arg[1] ] is the right operand. - -\param parameter -vector of parameter values. -*/ -template -inline void forward_eqpp_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(EqppOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(EqppOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base x = parameter[ arg[0] ]; - Base y = parameter[ arg[1] ]; - - count += size_t(x != y); -} -/*! -Zero order forward mode comparison check that left == right - -\copydetails CppAD::local::forward_lepv_op_0 -*/ -template -inline void forward_eqpv_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter , - size_t cap_order , - Base* taylor ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(EqpvOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(EqpvOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base x = parameter[ arg[0] ]; - Base* y = taylor + size_t(arg[1]) * cap_order; - - count += size_t(x != y[0]); -} -/*! -Zero order forward mode comparison check that left == right - -\copydetails CppAD::local::forward_levv_op_0 -*/ -template -inline void forward_eqvv_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter , - size_t cap_order , - Base* taylor ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(EqvvOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(EqvvOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base* x = taylor + size_t(arg[0]) * cap_order; - Base* y = taylor + size_t(arg[1]) * cap_order; - - count += size_t(x[0] != y[0]); -} -// -------------------------------- != ----------------------------------- -/*! -Zero order forward mode comparison check that left != right - -\param count -It the condition is not true, ths counter is incremented by one. - -\param arg -parameter[ arg[0] ] is the left operand and -parameter[ arg[1] ] is the right operand. - -\param parameter -vector of parameter values. -*/ -template -inline void forward_nepp_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(NeppOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(NeppOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base x = parameter[ arg[0] ]; - Base y = parameter[ arg[1] ]; - - count += size_t(x == y); -} -/*! -Zero order forward mode comparison check that left != right - -\copydetails CppAD::local::forward_lepv_op_0 -*/ -template -inline void forward_nepv_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter , - size_t cap_order , - Base* taylor ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(NepvOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(NepvOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base x = parameter[ arg[0] ]; - Base* y = taylor + size_t(arg[1]) * cap_order; - - count += size_t(x == y[0]); -} -/*! -Zero order forward mode comparison check that left != right - -\copydetails CppAD::local::forward_levv_op_0 -*/ -template -inline void forward_nevv_op_0( - size_t& count , - const addr_t* arg , - const Base* parameter , - size_t cap_order , - Base* taylor ) -{ - // check assumptions - CPPAD_ASSERT_UNKNOWN( NumArg(NevvOp) == 2 ); - CPPAD_ASSERT_UNKNOWN( NumRes(NevvOp) == 0 ); - - // Taylor coefficients corresponding to arguments and result - Base* x = taylor + size_t(arg[0]) * cap_order; - Base* y = taylor + size_t(arg[1]) * cap_order; - - count += size_t(x[0] == y[0]); -} - - -} } } // END namespace -# endif diff --git a/include/cppad/local/var_op/var_op.hpp b/include/cppad/local/var_op/var_op.hpp index 7b8696060..60c1777c7 100644 --- a/include/cppad/local/var_op/var_op.hpp +++ b/include/cppad/local/var_op/var_op.hpp @@ -18,7 +18,6 @@ # include # include # include -# include # include # include # include