22 static IntervalVector fwd(
const IntervalVector& x1, Index i, Index j);
23 static VectorType fwd_natural(
const VectorType& x1, Index i, Index j);
24 static VectorType fwd_centered(
const VectorType& x1, Index i, Index j);
25 static void bwd(
const IntervalVector& y, IntervalVector& x1, Index i, Index j);
31 class AnalyticOperationExpr<SubvectorOp,VectorType,VectorType> :
public AnalyticExpr<VectorType>,
public OperationExprBase<AnalyticExpr<VectorType>>
35 AnalyticOperationExpr(
const std::shared_ptr<AnalyticExpr<VectorType>>& x1, Index i, Index j)
36 : OperationExprBase<AnalyticExpr<VectorType>>(x1), _i(i), _j(j)
39 AnalyticOperationExpr(
const AnalyticOperationExpr& e)
40 : OperationExprBase<AnalyticExpr<VectorType>>(e), _i(e._i), _j(e._j)
43 std::shared_ptr<ExprBase> copy()
const
45 return std::make_shared<AnalyticOperationExpr<SubvectorOp,VectorType,VectorType>>(*this);
48 void replace_expr(
const ExprID& old_expr_id,
const std::shared_ptr<ExprBase>& new_expr)
50 return OperationExprBase<AnalyticExpr<VectorType>>::replace_expr(old_expr_id, new_expr);
53 VectorType fwd_eval(ValuesMap& v, Index total_input_size,
bool natural_eval)
const
56 return AnalyticExpr<VectorType>::init_value(
57 v, SubvectorOp::fwd_natural(std::get<0>(this->_x)->fwd_eval(v, total_input_size, natural_eval), _i, _j));
59 return AnalyticExpr<VectorType>::init_value(
60 v, SubvectorOp::fwd_centered(std::get<0>(this->_x)->fwd_eval(v, total_input_size, natural_eval), _i, _j));
63 void bwd_eval(ValuesMap& v)
const
65 SubvectorOp::bwd(AnalyticExpr<VectorType>::value(v).a, std::get<0>(this->_x)->value(v).a, _i, _j);
66 std::get<0>(this->_x)->bwd_eval(v);
69 virtual bool belongs_to_args_list(
const FunctionArgsList& args)
const
71 return std::get<0>(this->_x)->belongs_to_args_list(args);
81 inline IntervalVector SubvectorOp::fwd(
const IntervalVector& x1, Index i, Index j)
83 assert(i >= 0 && i < x1.size() && j >= i && j < x1.size());
84 return x1.subvector(i,j);
87 inline VectorType SubvectorOp::fwd_natural(
const VectorType& x1, Index i, Index j)
89 assert(i >= 0 && i < x1.a.rows() && j >= i && j < x1.a.rows());
96 inline VectorType SubvectorOp::fwd_centered(
const VectorType& x1, Index i, Index j)
98 if(centered_form_not_available_for_args(x1))
99 return fwd_natural(x1,i,j);
101 assert(i >= 0 && i < x1.a.rows() && j >= i && j < x1.a.rows());
105 x1.da.block(i,0,j-i+1,x1.da.cols()),
110 inline void SubvectorOp::bwd(
const IntervalVector& y, IntervalVector& x1, Index i, Index j)
112 assert(i >= 0 && i < x1.size() && j >= i && j < x1.size());
113 assert(j-i < y.size());
114 for(Index k = 0 ; k < j-i+1 ; k++)