102 for (
const ScalarOut*
e :
it.second) {
116 if (node.
getName() !=
nullptr) {
117 if (
a.getOperationNode() !=
nullptr) {
118 a.getOperationNode()->setName(*node.
getName());
129 CPPADCG_ASSERT_KNOWN(
args.size() == 1,
"Invalid number of arguments for print()")
137 if (
out.getOperationNode() !=
nullptr) {
140 if (
out.isValueDefined())
154 CPPADCG_ASSERT_KNOWN(
op == CGOpCode::AtomicForward ||
op == CGOpCode::AtomicReverse,
155 "Invalid operation type")
158 if (evals_[node] !=
nullptr) {
165 CPPADCG_ASSERT_KNOWN(
info.size() == 3,
"Invalid number of information data for atomic operation")
169 CPPADCG_ASSERT_KNOWN(
inArgs.size() == 2 *
p1,
"Invalid number of information data for atomic operation")
172 throw CGException(
"Evaluator is unable to determine the new CodeHandler for an atomic operation");
181 for (
size_t i = 0;
i <
inArgs.size();
i++) {
183 CPPADCG_ASSERT_KNOWN(
a !=
nullptr,
"Invalid argument for atomic operation")
194 if (
op == CGOpCode::AtomicForward) {
198 throw CGException(
"Atomic function for ID ",
id,
" is not defined in evaluator");
202 auto& atomic = *
itAFun->second;
206 for (
size_t i = 0;
i <
tx.size(); ++
i)
208 for (
size_t i = 0;
i <
ty.size(); ++
i)
216 for (
size_t i = 0;
i <
ty.size(); ++
i) {
217 if (
ty[
i].isValueDefined())
218 yOut[
i] =
new ScalarOut(
ty[
i].getValue());
231 if (evals_[node] !=
nullptr) {
232 return *evals_[node];
237 CPPADCG_ASSERT_KNOWN(
args.size() == 2,
"Invalid number of arguments for array element")
238 CPPADCG_ASSERT_KNOWN(
args[0].getOperation() !=
nullptr,
"Invalid argument for array element")
239 CPPADCG_ASSERT_KNOWN(
args[1].getOperation() !=
nullptr,
"Invalid argument for array element")
240 CPPADCG_ASSERT_KNOWN(
info.size() == 1,
"Invalid number of information data for array element")
241 size_t index =
info[0];
245 auto&
thisOps =
static_cast<FinalEvaluatorType&
>(*this);
254 const std::vector<ScalarOut*>&
yOut =
it->second;
255 if (index <
yOut.size() &&
yOut[index] !=
nullptr)
262 inline ActiveOut makeArray(
const NodeIn& node) {
263 if (node.getOperationType() == CGOpCode::ArrayCreation) {
264 return makeDenseArray(node);
266 return makeSparseArray(node);
270 inline ActiveOut makeArray(
const NodeIn& node,
271 std::vector<ScalarOut>& values,
277 if (node.getOperationType() == CGOpCode::ArrayCreation) {
278 result = makeDenseArray(node);
281 result = makeSparseArray(node);
282 arrayActiveOut = this->evalsSparseArrays_[node.getHandlerPosition()];
290 inline ActiveOut makeDenseArray(
const NodeIn& node) {
291 CPPADCG_ASSERT_KNOWN(node.getOperationType() == CGOpCode::ArrayCreation,
"Invalid array creation operation")
295 if (evals_[node] !=
nullptr) {
296 return *evals_[node];
300 throw CGException(
"Evaluator is unable to determine the new CodeHandler for an array creation operation");
304 const std::vector<ActiveOut>& array = this->evalArrayCreationOperation(node);
307 return *this->saveEvaluation(node, ActiveOut(*
outHandler_->makeNode(CGOpCode::ArrayCreation, {}, asArguments(array))));
310 inline ActiveOut makeSparseArray(
const NodeIn& node) {
311 CPPADCG_ASSERT_KNOWN(node.getOperationType() == CGOpCode::SparseArrayCreation,
"Invalid sparse array creation operation")
315 if (evals_[node] !=
nullptr) {
316 return *evals_[node];
320 throw CGException(
"Evaluator is unable to determine the new CodeHandler for a sparse array creation operation");
324 const std::vector<ActiveOut>& array = this->evalSparseArrayCreationOperation(node);
327 return *this->saveEvaluation(node, ActiveOut(*
outHandler_->makeNode(CGOpCode::SparseArrayCreation, node.getInfo(), asArguments(array))));
330 static inline void processArray(
const std::vector<ActiveOut>& array,
331 std::vector<ScalarOut>& values,
334 values.resize(array.size());
335 for (
size_t i = 0;
i < array.size();
i++) {
336 if (!array[
i].isValueDefined()) {
341 values[
i] = array[
i].getValue();
342 if (!array[
i].isParameter())
349 for (
size_t i = 0;
i <
tx.size();
i++) {
350 if (!
tx[
i].isParameter()) {
357 static inline bool isValuesDefined(
const std::vector<ArgOut>&
tx) {
358 for (
size_t i = 0;
i <
tx.size();
i++) {
359 if (
tx[
i].getOperationNode() !=
nullptr) {