-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
master: fix isnan ambibuity on Visual C++ 2022.
- Loading branch information
Showing
10 changed files
with
61 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# define CPPAD_CORE_GRAPH_FROM_GRAPH_HPP | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later | ||
// SPDX-FileCopyrightText: Bradley M. Bell <[email protected]> | ||
// SPDX-FileContributor: 2003-23 Bradley M. Bell | ||
// SPDX-FileContributor: 2003-24 Bradley M. Bell | ||
// ---------------------------------------------------------------------------- | ||
|
||
# include <cppad/core/ad_fun.hpp> | ||
|
@@ -268,7 +268,7 @@ void CppAD::ADFun<Base,RecBase>::from_graph( | |
CPPAD_ASSERT_UNKNOWN( parameter.size() == 0 ); | ||
addr_t i_par = rec.put_con_par(nan); | ||
CPPAD_ASSERT_UNKNOWN( i_par == 0 ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_par] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_par] ) ); | ||
// | ||
// Place the variable with index 0 in the tape | ||
CPPAD_ASSERT_NARG_NRES(local::BeginOp, 1, 1); | ||
|
@@ -286,7 +286,7 @@ void CppAD::ADFun<Base,RecBase>::from_graph( | |
} | ||
else | ||
{ i_par = rec.put_dyn_par(nan, local::ind_dyn ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_par] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_par] ) ); | ||
node_type.push_back(dynamic_enum); | ||
node2fun.push_back(i_par); | ||
} | ||
|
@@ -297,7 +297,7 @@ void CppAD::ADFun<Base,RecBase>::from_graph( | |
for(size_t i = 0; i < n_variable_ind; ++i) | ||
{ if( var2dyn[i] ) | ||
{ i_par = rec.put_dyn_par(nan, local::ind_dyn ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_par] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_par] ) ); | ||
node_type.push_back(dynamic_enum); | ||
node2fun.push_back(i_par); | ||
} | ||
|
@@ -530,7 +530,7 @@ void CppAD::ADFun<Base,RecBase>::from_graph( | |
{ i_result = rec.put_dyn_par( | ||
nan, local::add_dyn, i_result, temporary[j] | ||
); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
} | ||
} | ||
else | ||
|
@@ -975,112 +975,112 @@ void CppAD::ADFun<Base,RecBase>::from_graph( | |
{ | ||
case abs_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::abs_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case acosh_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::acosh_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case asinh_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::asinh_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case atanh_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::atanh_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case erf_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::erf_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case erfc_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::erfc_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case expm1_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::expm1_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case log1p_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::log1p_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case acos_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::acos_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case asin_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::asin_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case atan_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::atan_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case cosh_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::cosh_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case cos_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::cos_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case exp_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::exp_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case log_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::log_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case neg_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::neg_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case sign_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::sign_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case sinh_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::sinh_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case sin_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::sin_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case sqrt_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::sqrt_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case tanh_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::tanh_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case tan_graph_op: | ||
i_result = rec.put_dyn_par(nan, local::tan_dyn, arg[0] ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
default: | ||
|
@@ -1367,19 +1367,19 @@ void CppAD::ADFun<Base,RecBase>::from_graph( | |
case add_graph_op: | ||
i_result = | ||
rec.put_dyn_par(nan, local::add_dyn, arg[0], arg[1]); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case azmul_graph_op: | ||
i_result = | ||
rec.put_dyn_par(nan, local::zmul_dyn, arg[0], arg[1]); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case div_graph_op: | ||
i_result = | ||
rec.put_dyn_par(nan, local::div_dyn, arg[0], arg[1]); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case mul_graph_op: | ||
|
@@ -1390,13 +1390,13 @@ void CppAD::ADFun<Base,RecBase>::from_graph( | |
case pow_graph_op: | ||
i_result = | ||
rec.put_dyn_par(nan, local::pow_dyn, arg[0], arg[1]); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
case sub_graph_op: | ||
i_result = | ||
rec.put_dyn_par(nan, local::sub_dyn, arg[0], arg[1]); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[i_result] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[i_result] ) ); | ||
break; | ||
|
||
default: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later | ||
// SPDX-FileCopyrightText: Bradley M. Bell <[email protected]> | ||
// SPDX-FileContributor: 2003-23 Bradley M. Bell | ||
// SPDX-FileContributor: 2003-24 Bradley M. Bell | ||
// ---------------------------------------------------------------------------- | ||
|
||
# include <cppad/core/ad_fun.hpp> | ||
|
@@ -113,7 +113,7 @@ void CppAD::ADFun<Base,RecBase>::to_graph( | |
CPPAD_ASSERT_UNKNOWN( n_dynamic_ind <= n_dynamic ); | ||
CPPAD_ASSERT_UNKNOWN( dyn_par_is.size() == n_parameter ); | ||
CPPAD_ASSERT_UNKNOWN( n_parameter > 0 ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[0] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[0] ) ); | ||
CPPAD_ASSERT_UNKNOWN( ! dyn_par_is[0] ); | ||
// -------------------------------------------------------------------- | ||
// par2node | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# define CPPAD_EXAMPLE_CPPAD_EIGEN_HPP | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later | ||
// SPDX-FileCopyrightText: Bradley M. Bell <[email protected]> | ||
// SPDX-FileContributor: 2003-23 Bradley M. Bell | ||
// SPDX-FileContributor: 2003-24 Bradley M. Bell | ||
// ---------------------------------------------------------------------------- | ||
|
||
/* | ||
|
@@ -244,7 +244,7 @@ namespace std { | |
{ return isfinite(CppAD::Value( CppAD::Var2Par(x) ) ); } | ||
|
||
template <class Base> bool isnan(const CppAD::AD<Base> &x) | ||
{ return isnan(CppAD::Value( CppAD::Var2Par(x) ) ); } | ||
{ return CppAD::isnan(CppAD::Value( CppAD::Var2Par(x) ) ); } | ||
} | ||
/* {xrst_code} | ||
{xrst_spell_on} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# define CPPAD_LOCAL_OPTIMIZE_GET_PAR_USAGE_HPP | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later | ||
// SPDX-FileCopyrightText: Bradley M. Bell <[email protected]> | ||
// SPDX-FileContributor: 2003-23 Bradley M. Bell | ||
// SPDX-FileContributor: 2003-24 Bradley M. Bell | ||
// ---------------------------------------------------------------------------- | ||
/*! | ||
\file get_cexp_info.hpp | ||
|
@@ -438,7 +438,7 @@ void get_par_usage( | |
type_x.resize(n); | ||
for(size_t j = 0; j < n; ++j) | ||
{ // parameter index zero is used for variable | ||
CPPAD_ASSERT_UNKNOWN( isnan( all_par_vec[0] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( all_par_vec[0] ) ); | ||
addr_t arg_j = dyn_par_arg[i_arg + 5 + j]; | ||
parameter_x[j] = all_par_vec[arg_j]; | ||
if( arg_j == 0 ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# define CPPAD_LOCAL_OPTIMIZE_OPTIMIZE_RUN_HPP | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later | ||
// SPDX-FileCopyrightText: Bradley M. Bell <[email protected]> | ||
// SPDX-FileContributor: 2003-23 Bradley M. Bell | ||
// SPDX-FileContributor: 2003-24 Bradley M. Bell | ||
// ---------------------------------------------------------------------------- | ||
|
||
# include <stack> | ||
|
@@ -329,7 +329,7 @@ bool optimize_run( | |
rec->set_record_compare( compare_op ); | ||
|
||
// copy parameters with index 0 | ||
CPPAD_ASSERT_UNKNOWN( ! dyn_par_is[0] && isnan( play->GetPar(0) ) ); | ||
CPPAD_ASSERT_UNKNOWN( ! dyn_par_is[0] && CppAD::isnan( play->GetPar(0) ) ); | ||
rec->put_con_par( play->GetPar(0) ); | ||
new_par[0] = 0; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# define CPPAD_LOCAL_RECORD_PUT_DYN_ATOMIC_HPP | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later | ||
// SPDX-FileCopyrightText: Bradley M. Bell <[email protected]> | ||
// SPDX-FileContributor: 2003-23 Bradley M. Bell | ||
// SPDX-FileContributor: 2003-24 Bradley M. Bell | ||
// ---------------------------------------------------------------------------- | ||
# include <cppad/local/record/recorder.hpp> | ||
|
||
|
@@ -133,7 +133,7 @@ void recorder<Base>::put_dyn_atomic( | |
|
||
case variable_enum: | ||
arg = 0; // phantom parameter index | ||
CPPAD_ASSERT_UNKNOWN( isnan( all_par_vec_[arg] ) ) | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( all_par_vec_[arg] ) ) | ||
break; | ||
|
||
default: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# define CPPAD_LOCAL_RECORD_RECORDER_HPP | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later | ||
// SPDX-FileCopyrightText: Bradley M. Bell <[email protected]> | ||
// SPDX-FileContributor: 2003-22 Bradley M. Bell | ||
// SPDX-FileContributor: 2003-24 Bradley M. Bell | ||
// ---------------------------------------------------------------------------- | ||
# include <cppad/core/hash_code.hpp> | ||
# include <cppad/local/pod_vector.hpp> | ||
|
@@ -541,7 +541,7 @@ addr_t recorder<Base>::put_con_par(const Base &par) | |
// index zero is used to signify that a value is not a parameter; | ||
// i.e., it is a variable. | ||
if( all_par_vec_.size() == 0 ) | ||
CPPAD_ASSERT_UNKNOWN( isnan(par) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan(par) ); | ||
# endif | ||
// --------------------------------------------------------------------- | ||
// check for a match with a previous parameter | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# define CPPAD_LOCAL_VAL_GRAPH_VAL2FUN_HPP | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later | ||
// SPDX-FileCopyrightText: Bradley M. Bell <[email protected]> | ||
// SPDX-FileContributor: 2003-23 Bradley M. Bell | ||
// SPDX-FileContributor: 2003-24 Bradley M. Bell | ||
// -------------------------------------------------------------------------- | ||
/* | ||
{xrst_begin val2fun_graph dev} | ||
|
@@ -228,7 +228,7 @@ void ADFun<Base, RecBase>::val2fun( | |
// initialize with the value nan at index nan | ||
par_addr = rec.put_con_par(nan); | ||
CPPAD_ASSERT_UNKNOWN( par_addr == 0 ); | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[par_addr] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[par_addr] ) ); | ||
// | ||
// rec | ||
// Place the variable with index 0 in the tape | ||
|
@@ -270,7 +270,7 @@ void ADFun<Base, RecBase>::val2fun( | |
fun_ad_type[ dyn_ind[i] ] = dynamic_enum; | ||
par_addr = rec.put_dyn_par(nan, local::ind_dyn); | ||
val2fun_index[ dyn_ind[i] ] = par_addr; | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[par_addr] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[par_addr] ) ); | ||
} | ||
// put the independent variables in the function recording | ||
for(size_t i = 0; i < var_n_ind; ++i) | ||
|
@@ -484,7 +484,7 @@ void ADFun<Base, RecBase>::val2fun( | |
CPPAD_VAL2FUN_DYN_BINARY(div); | ||
CPPAD_VAL2FUN_DYN_BINARY(pow); | ||
} | ||
CPPAD_ASSERT_UNKNOWN( isnan( parameter[tmp_addr] ) ); | ||
CPPAD_ASSERT_UNKNOWN( CppAD::isnan( parameter[tmp_addr] ) ); | ||
} | ||
else if( | ||
ad_type_x[0] == variable_enum && | ||
|
Oops, something went wrong.