10 auto f = std::make_shared<SinOperator>(2);
11 auto g = std::make_shared<ExpOperator>(2);
12 auto sum = std::make_shared<SumPiece>(2);
15 auto splitter = std::make_shared<SplitVector>(std::vector<int>{0,2},
16 std::vector<int>{2,2},
19 auto graph = std::make_shared<WorkGraph>();
21 graph->AddNode(splitter,
"x12,x34");
22 graph->AddNode(g,
"g");
23 graph->AddNode(f,
"f");
24 graph->AddEdge(
"x12,x34",0,
"f",0);
25 graph->AddEdge(
"x12,x34",0,
"g",0);
27 graph->AddNode(sum,
"f+g");
28 graph->AddEdge(
"f",0,
"f+g",0);
29 graph->AddEdge(
"g",0,
"f+g",1);
31 auto mod = graph->CreateModPiece(
"f+g");
33 Eigen::VectorXd x = Eigen::VectorXd::Random(4);
34 std::cout <<
"result = " << mod->Evaluate(x).at(0).transpose() << std::endl;