21 template<
typename X1,
typename X2,
typename P>
22 static std::string str(
const X1& x1,
const X2& x2,
const P& p)
24 return "mod(" + x1->str() +
"," + x2->str() +
"," + p->str() +
")";
27 template<
typename X1,
typename X2>
28 static std::pair<Index,Index> output_shape([[maybe_unused]]
const X1& s1, [[maybe_unused]]
const X2& s2)
33 static void bwd(Interval& x1, Interval& x2,
double p);
34 static void bwd(Interval& x1, Interval& x2, Interval& p);
45 assert_release(p > 0. &&
"Modulo needs a strictly positive period p.");
47 if(!(x2.diam() > p || x1.diam() > p))
49 Interval r = (x1-x2)/p;
60 if(ir.is_degenerated())
61 SubOp::bwd(ir*p,x1,x2);
63 else if(ir.diam() == 1.)
67 Interval x1_1 = x1; Interval x1_2 = x1;
68 Interval x2_1 = x2; Interval x2_2 = x2;
69 SubOp::bwd(Interval(ir1*p),x1_1,x2_1);
70 SubOp::bwd(Interval(ir2*p),x1_2,x2_2);
77 assert_release(
false &&
"Modulo diameter error.");
85 assert_release(p.is_degenerated() &&
"ModOp::bwd(y,x1,x2) (with x1 and x2 intervals) not implemented yet");
86 ModOp::bwd(x1, x2, p.mid());
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:62
Interval integer(const Interval &x)
Returns the largest integer interval included in .
Definition codac2_Interval_operations_impl.h:284