1#ifndef CPPAD_CG_CG_INCLUDED
2#define CPPAD_CG_CG_INCLUDED
35 OperationNode<Base>* node_;
40 std::unique_ptr<Base> value_;
53 inline CG(OperationNode<Base>& node);
58 inline CG(
const CG<Base>& orig);
63 inline CG(CG<Base>&& orig);
80 inline CG(
const Base& val);
129 inline const Base&
getValue()
const;
137 inline void setValue(
const Base& val);
139 inline bool isIdenticalZero()
const;
140 inline bool isIdenticalOne()
const;
142 inline OperationNode<Base>* getOperationNode()
const;
145 inline CG<Base>& operator+=(
const CG<Base>& right);
146 inline CG<Base>& operator-=(
const CG<Base>& right);
147 inline CG<Base>& operator*=(
const CG<Base>& right);
148 inline CG<Base>& operator/=(
const CG<Base>& right);
149 inline CG<Base>& operator+=(
const Base& right);
150 inline CG<Base>& operator-=(
const Base& right);
151 inline CG<Base>& operator*=(
const Base& right);
152 inline CG<Base>& operator/=(
const Base& right);
155 inline CG<Base>& operator+=(
const T &right);
157 inline CG<Base>& operator-=(
const T &right);
159 inline CG<Base>& operator/=(
const T &right);
161 inline CG<Base>& operator*=(
const T &right);
164 inline CG<Base> operator+()
const;
165 inline CG<Base> operator-()
const;
173 inline CG(
const Argument<Base>& arg);
176 inline void makeParameter(
const Base& b);
178 inline void makeVariable(OperationNode<Base>& operation);
180 inline void makeVariable(OperationNode<Base>& operation,
181 std::unique_ptr<Base>& value);
184 inline Argument<Base> argument()
const;
190 friend class CodeHandler<Base>;
191 friend class CGAbstractAtomicFun<Base>;
192 friend class Loop<Base>;
193 friend class LoopModel<Base>;
207 friend bool GreaterThanOrZero <Base> (
const CG<Base>& x);
208 friend bool LessThanZero <Base> (
const CG<Base>& x);
209 friend bool LessThanOrZero <Base> (
const CG<Base>& x);
216 friend bool NearEqual <Base> (
const CG<Base>& x,
const CG<Base>& y,
const Base& r,
const Base& a);
217 friend bool NearEqual <Base> (
const Base& x,
const CG<Base>& y,
const Base& r,
const Base& a);
218 friend bool NearEqual <Base> (
const CG<Base>& x,
const Base& y,
const Base& r,
const Base& a);
226 bool (*compare)(
const Base&,
const Base&));
249#if CPPAD_USE_CPLUSPLUS_2011
270 static thread_local std::function<std::ostream& (std::ostream&,
const CG<Base>&)> FUNC;
281inline std::ostream& operator<<(
289 if (v.isParameter()) {
292 os << *v.getOperationNode();
293 if (v.isValueDefined()) {
294 os <<
" (" << v.getValue() <<
")";
301inline std::ostringstream& operator<<(
302 std::ostringstream& os,
305 if (v.isParameter()) {
308 os << *v.getOperationNode();
309 if (v.isValueDefined()) {
310 os <<
" (" << v.getValue() <<
")";
317inline std::istream& operator>>(
334 CppAD::ErrorHandler::Call(
false, __LINE__, __FILE__,
"Integer()",
"No value defined");
friend CG< Base > sign(const CG< Base > &x)
void setValue(const Base &val)
CG & operator=(const CG< Base > &rhs)
const Base & getValue() const
bool isValueDefined() const
CodeHandler< Base > * getCodeHandler() const
friend bool GreaterThanZero(const CG< Base > &x)
friend CG< Base > pow(const CG< Base > &x, const CG< Base > &y)
friend CG< Base > CondExp(CGOpCode op, const CG< Base > &left, const CG< Base > &right, const CG< Base > &trueCase, const CG< Base > &falseCase, bool(*compare)(const Base &, const Base &))