CppADCodeGen
HEAD
A C++ Algorithmic Differentiation Package with Source Code Generation
ordered.hpp
1
#ifndef CPPAD_CG_ORDERED_INCLUDED
2
#define CPPAD_CG_ORDERED_INCLUDED
3
/* --------------------------------------------------------------------------
4
* CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
5
* Copyright (C) 2012 Ciengis
6
*
7
* CppADCodeGen is distributed under multiple licenses:
8
*
9
* - Eclipse Public License Version 1.0 (EPL1), and
10
* - GNU General Public License Version 3 (GPL3).
11
*
12
* EPL1 terms and conditions can be found in the file "epl-v10.txt", while
13
* terms and conditions for the GPL3 can be found in the file "gpl3.txt".
14
* ----------------------------------------------------------------------------
15
* Author: Joao Leal
16
*/
17
18
namespace
CppAD
{
19
20
template
<
class
Base>
21
bool
GreaterThanZero
(
const
cg::CG<Base>
&x) {
22
if
(!x.
isParameter
()) {
23
throw
cg::CGException
(
"GreaterThanZero cannot be called for non-parameters"
);
24
}
25
26
return
GreaterThanZero
(x.
getValue
());
27
}
28
29
template
<
class
Base>
30
bool
GreaterThanOrZero(
const
cg::CG<Base>
&x) {
31
if
(!x.
isParameter
()) {
32
throw
cg::CGException
(
"GreaterThanOrZero cannot be called for non-parameters"
);
33
}
34
35
return
GreaterThanOrZero(x.
getValue
());
36
}
37
38
template
<
class
Base>
39
bool
LessThanZero(
const
cg::CG<Base>
&x) {
40
if
(!x.
isParameter
()) {
41
throw
cg::CGException
(
"LessThanZero cannot be called for non-parameters"
);
42
}
43
44
return
LessThanZero(x.
getValue
());
45
}
46
47
template
<
class
Base>
48
bool
LessThanOrZero(
const
cg::CG<Base>
&x) {
49
if
(!x.
isParameter
()) {
50
throw
cg::CGException
(
"LessThanOrZero cannot be called for non-parameters"
);
51
}
52
53
return
LessThanOrZero(x.
getValue
());
54
}
55
56
template
<
class
Base>
57
bool
abs_geq(
const
cg::CG<Base>
& x,
58
const
cg::CG<Base>
& y) {
59
if
(!x.
isParameter
()) {
60
throw
cg::CGException
(
"abs_geq cannot be called for non-parameters (x)"
);
61
}
else
if
(!y.
isParameter
()) {
62
throw
cg::CGException
(
"abs_geq cannot be called for non-parameters (y)"
);
63
}
64
65
return
abs_geq(x.
getValue
(), y.
getValue
());
66
}
67
68
}
// END CppAD namespace
69
70
#endif
CppAD::cg::CG
Definition:
cg.hpp:29
CppAD::cg::CG::getValue
const Base & getValue() const
Definition:
variable.hpp:45
CppAD::cg::CGException
Definition:
exception.hpp:27
CppAD::GreaterThanZero
bool GreaterThanZero(const cg::CG< Base > &x)
Definition:
ordered.hpp:21
CppAD
Definition:
abstract_atomic_fun.hpp:19
CppAD::cg::CG::isParameter
bool isParameter() const
Definition:
variable.hpp:35
include
cppad
cg
ordered.hpp
Generated on Sat May 3 2025 16:08:05 for CppADCodeGen by
1.8.13