CppADCodeGen
2.4.3
A C++ Algorithmic Differentiation Package with Source Code Generation
Loading...
Searching...
No Matches
unary.hpp
1
#ifndef CPPAD_CG_UNARY_INCLUDED
2
#define CPPAD_CG_UNARY_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
namespace
cg {
20
21
template
<
class
Base>
22
inline
CG<Base>
CG<Base>::operator+()
const
{
23
return
CG<Base>
(*
this
);
// nothing to do
24
}
25
26
template
<
class
Base>
27
inline
CG<Base>
CG<Base>::operator-()
const
{
28
if
(isParameter()) {
29
return
CG<Base>
(-getValue());
30
31
}
else
{
32
CodeHandler<Base>
& h = *getCodeHandler();
33
CG<Base>
result(*h.makeNode(CGOpCode::UnMinus, this->argument()));
34
if
(isValueDefined()) {
35
result.setValue(-getValue());
36
}
37
return
result;
38
}
39
}
40
41
}
// END cg namespace
42
}
// END CppAD namespace
43
44
#endif
CppAD::cg::CG
Definition
cg.hpp:29
CppAD::cg::CodeHandler
Definition
code_handler.hpp:28
CppAD
Definition
abstract_atomic_fun.hpp:19
include
cppad
cg
unary.hpp
Generated on Fri Sep 11 2026 05:54:47 for CppADCodeGen by
1.13.2