22 static std::string str(
const X1& x1)
24 return "flatten(" + x1->str() +
")";
28 static std::pair<Index,Index> output_shape(
const X1& s1)
30 auto shape1 = s1->output_shape();
31 return { shape1.second*shape1.first, 1 };
34 static IntervalVector fwd(
const IntervalMatrix& x1);
35 static VectorType fwd_natural(
const MatrixType& x1);
36 static VectorType fwd_centered(
const MatrixType& x1);
37 static void bwd(
const IntervalVector& y, IntervalMatrix& x1);
44 flatten(
const MatrixExpr &x1)
46 return { std::make_shared<AnalyticOperationExpr<FlattenOp,VectorType,MatrixType>>(x1) };
51 inline IntervalVector FlattenOp::fwd(
const IntervalMatrix& x1)
56 inline VectorType FlattenOp::fwd_natural(
const MatrixType& x1)
64 inline VectorType FlattenOp::fwd_centered(
const MatrixType& x1)
66 if(centered_form_not_available_for_args(x1))
67 return fwd_natural(x1);
77 inline void FlattenOp::bwd(
const IntervalVector& y, IntervalMatrix& x1)
79 x1 &= y.reshaped(x1.rows(),x1.cols());