codac 2.1.2
Loading...
Searching...
No Matches
codac2_SlicedTube.h
Go to the documentation of this file.
1
9
10#pragma once
11
15#include "codac2_CtcDeriv.h"
16#include "codac2_Scalar.h"
17#include "codac2_AnalyticTraj.h"
18
19namespace codac2
20{
36 template<typename T>
38 {
39 public:
40
47 explicit SlicedTube(const std::shared_ptr<TDomain>& tdomain,
48 const T& codomain)
50 {
51 for(auto it = _tdomain->begin(); it != _tdomain->end(); ++it)
52 it->_slices.insert({
53 this,
54 std::make_shared<Slice<T>>(*this, it, codomain)
55 });
56 }
57
67 explicit SlicedTube(const std::shared_ptr<TDomain>& tdomain,
68 const AnalyticFunction<typename ExprType<T>::Type>& f)
70 {
71 assert_release(f.args().size() == 1
72 && "function's inputs must be limited to one system variable");
73
74 for(auto it = _tdomain->begin(); it != _tdomain->end(); ++it)
75 it->_slices.insert({
76 this,
77 std::make_shared<Slice<T>>(*this, it, f.eval((Interval)*it))
78 });
79 }
80
90 template<typename V>
91 requires std::is_same_v<typename ExprType<T>::Type,V>
92 explicit SlicedTube(const std::shared_ptr<TDomain>& tdomain,
93 const AnalyticTraj<V>& x)
95 {
96 for(auto it = _tdomain->begin(); it != _tdomain->end(); ++it)
97 it->_slices.insert({
98 this,
99 std::make_shared<Slice<T>>(*this, it, x.eval((Interval)*it))
100 });
101 }
102
110 template<typename V>
111 requires std::is_same_v<typename Wrapper<V>::Domain,T>
112 explicit SlicedTube(const std::shared_ptr<TDomain>& tdomain,
113 const SampledTraj<V>& x)
115 {
116 for(auto it = _tdomain->begin(); it != _tdomain->end(); ++it)
117 it->_slices.insert({
118 this,
119 std::make_shared<Slice<T>>(*this, it, x((Interval)*it))
120 });
121 }
122
132 {
133 for(auto it = _tdomain->begin(); it != _tdomain->end(); ++it)
134 it->_slices.insert({
135 this,
136 std::make_shared<Slice<T>>(*x.slice(it), *this)
137 });
138 }
139
149 {
150 assert_release(_tdomain == x._tdomain);
151
152 for(auto it = _tdomain->begin(); it != _tdomain->end(); ++it)
153 slice(it)->set(x.slice(it)->codomain(), false);
154
155 return *this;
156 }
157
163 inline Index size() const
164 {
165 return first_slice()->size();
166 }
167
175 virtual std::pair<Index,Index> shape() const
176 {
177 if constexpr(std::is_same_v<typename ExprType<T>::Type,ScalarType>)
178 return {1,1};
179 else
180 return {first_slice()->codomain().rows(),first_slice()->codomain().cols()};
181 }
182
190 inline double volume() const
191 {
192 double volume = 0.;
193 for(const auto& s : *this)
194 if(!s.is_gate())
195 volume += s.volume();
196 return volume;
197 }
198
204 inline std::shared_ptr<Slice<T>> first_slice()
205 {
206 return std::const_pointer_cast<Slice<T>>(
207 static_cast<const SlicedTube&>(*this).first_slice());
208 }
209
215 inline std::shared_ptr<const Slice<T>> first_slice() const
216 {
217 return std::static_pointer_cast<const Slice<T>>(
219 }
220
226 inline std::shared_ptr<Slice<T>> last_slice()
227 {
228 return std::const_pointer_cast<Slice<T>>(
229 static_cast<const SlicedTube&>(*this).last_slice());
230 }
231
237 inline std::shared_ptr<const Slice<T>> last_slice() const
238 {
239 return std::static_pointer_cast<const Slice<T>>(
241 }
242
249 inline std::shared_ptr<Slice<T>> slice(const std::list<TSlice>::iterator& it)
250 {
251 return std::const_pointer_cast<Slice<T>>(
252 static_cast<const SlicedTube&>(*this).slice(it));
253 }
254
261 inline std::shared_ptr<const Slice<T>> slice(const std::list<TSlice>::const_iterator& it) const
262 {
263 return std::static_pointer_cast<const Slice<T>>(
264 it->slices().at(this));
265 }
266
273 inline std::shared_ptr<Slice<T>> slice(const std::list<TSlice>::reverse_iterator& it)
274 {
275 return std::const_pointer_cast<Slice<T>>(
276 static_cast<const SlicedTube&>(*this).slice(it));
277 }
278
285 inline std::shared_ptr<const Slice<T>> slice(const std::list<TSlice>::const_reverse_iterator& it) const
286 {
287 return std::static_pointer_cast<const Slice<T>>(
288 it->slices().at(this));
289 }
290
299 inline std::shared_ptr<Slice<T>> slice(std::shared_ptr<TSlice> ptr)
300 {
301 // Used in Python binding
302 auto it = std::find_if(_tdomain->begin(), _tdomain->end(),
303 [&](TSlice& t){ return &t == ptr.get(); });
304 assert(it != _tdomain->end());
305 return slice(it);
306 }
307
316 inline bool is_empty() const
317 {
318 for(const auto& s : *this)
319 if(s.is_gate() && s.is_empty())
320 return true;
321 for(const auto& s : *this)
322 if(!s.is_gate() && s.is_empty())
323 return true;
324 return false;
325 }
326
332 inline bool is_unbounded() const
333 {
334 for(const auto& s : *this)
335 if(s.is_unbounded())
336 return true;
337 return false;
338 }
339
347 inline T codomain() const
348 {
349 T x = first_slice()->codomain();
350 for(const auto& s : *this)
351 x |= s.codomain();
352 return x;
353 }
354
355 template<typename Func>
356 inline T eval_common(const Interval& t, const Func& apply_eval) const
357 {
358 if(!tdomain()->t0_tf().is_superset(t))
359 return all_reals_value();
360
361 auto it = _tdomain->tslice(t.lb());
362 assert(it != _tdomain->end());
363 T codomain = apply_eval(it, t & *it);
364
365 while(it != std::next(_tdomain->tslice(t.ub())))
366 {
367 if(it->lb() == t.ub()) break;
368 codomain |= apply_eval(it, t & *it);
369 it++;
370 }
371
372 return codomain;
373 }
374
381 T operator()(const Interval& t) const
382 {
383 return eval_common(t,
384 [this](auto it, const Interval& t_) {
385 return this->slice(it)->operator()(t_);
386 });
387 }
388
396 T operator()(const Interval& t, const SlicedTube<T>& v) const
397 requires (std::is_same_v<T,Interval> || std::is_same_v<T,IntervalVector>)
398 {
399 return eval_common(t,
400 [this,&v](auto it, const Interval& t_) {
401 return this->slice(it)->operator()(t_, *v.slice(it));
402
403 });
404 }
405
412 std::pair<T,T> enclosed_bounds(const Interval& t) const
413 {
414 auto x = this->empty_value();
415 auto bounds = std::make_pair(x,x);
416
417 if(t.lb() < _tdomain->t0_tf().lb() || t.ub() > _tdomain->t0_tf().ub())
418 {
419 x.init(Interval(-oo,0));
420 bounds.first |= x;
421 x.init(Interval(0,oo));
422 bounds.second |= x;
423 }
424
425 Interval t_inter = t & _tdomain->t0_tf();
426 auto si = slice(_tdomain->tslice(t_inter.lb()));
427
428 while(si && si->t0_tf().lb() <= t_inter.ub())
429 {
430 auto slice_bounds = si->enclosed_bounds(t_inter & si->t0_tf());
431 bounds.first |= slice_bounds.first;
432 bounds.second |= slice_bounds.second;
433 si = si->next_slice();
434 }
435
436 return bounds;
437 }
438
444 inline void set(const T& codomain)
445 {
446 assert_release(codomain.size() == this->size());
447
448 for(auto& s : *this)
449 if(!s.is_gate())
450 s.set(codomain, false);
451
452 for(auto& s : *this)
453 if(s.is_gate())
454 s.set(codomain, false);
455 }
456
465 inline void set(const T& codomain, double t)
466 {
467 assert_release(codomain.size() == this->size());
468 slice(_tdomain->sample(t,true))->set(codomain);
469 }
470
480 inline void set(const T& codomain, const Interval& t)
481 {
482 auto it_lb = _tdomain->sample(t.lb(), t.is_degenerated());
483 std::list<TSlice>::iterator it_ub;
484
485 if(!t.is_degenerated())
486 {
487 it_ub = _tdomain->sample(t.ub(), false);
488
489 if(it_ub->lb() == t.ub())
490 it_ub--; // pointing to the tslice [..,t.ub()]
491
492 if(it_lb->ub() == t.lb())
493 it_lb++;
494 }
495
496 else
497 it_ub = it_lb;
498
499 do
500 {
501 slice(it_lb)->set(codomain);
502 } while(it_lb != it_ub && (++it_lb) != _tdomain->end());
503 }
504
511 inline void set_ith_slice(const T& codomain, Index i)
512 {
513 Index j = 0;
514 for(auto& si : *this)
515 if(j++ == i)
516 {
517 si.set(codomain);
518 break;
519 }
520 }
521
529 template<typename V>
530 requires (std::is_same_v<typename Wrapper<V>::Domain,T> || std::is_same_v<V,double>)
531 const SlicedTube<T>& inflate(const V& rad)
532 {
533 // todo: faster implementation with iterators
534 for(auto& s : *this)
535 if(!s.is_gate())
536 s.set(T(s.codomain()).inflate(rad), false);
537
538 for(auto& s : *this)
539 if(s.is_gate())
540 s.set(T(s.codomain()).inflate(rad), false);
541
542 return *this;
543 }
544
552 template<typename V>
553 requires (std::is_same_v<typename Wrapper<V>::Domain,T> || std::is_same_v<V,double>)
554 const SlicedTube<T>& inflate(const SampledTraj<V>& rad)
555 {
556 // todo: faster implementation with iterators
557 assert_release(tdomain()->t0_tf().is_subset(rad.tdomain()));
558
559 for(auto& s : *this)
560 if(!s.is_gate())
561 s.set(T(s.codomain()).inflate(rad(s.t0_tf()).ub()), false);
562
563 for(auto& s : *this)
564 if(s.is_gate())
565 s.set(T(s.codomain()).inflate(rad(s.t0_tf()).ub()), false);
566
567 return *this;
568 }
569
577 {
578 assert_release(i >= 0 && i < size());
580 for(auto it = tdomain()->begin() ; it != tdomain()->end() ; it++)
581 xi.slice(it)->codomain() = slice(it)->codomain()[i];
582 return xi;
583 }
584
592 SlicedTube<IntervalVector> subvector(Index i, Index j) const
593 {
594 assert_release(i >= 0 && i <= j && j < size());
596 for(auto it = tdomain()->begin() ; it != tdomain()->end() ; it++)
597 xij.slice(it)->codomain() = slice(it)->codomain().subvector(i,j);
598 return xij;
599 }
600
610 inline bool operator==(const SlicedTube& x) const
611 {
613 return false;
614
615 auto it_this = _tdomain->begin();
616 auto it_x = x.tdomain()->cbegin();
617
618 while(it_this != _tdomain->end())
619 if(*slice(it_this++) != *x.slice(it_x++))
620 return false;
621
622 return true;
623 }
624
634 {
635 assert(TDomain::are_same(tdomain(), x.tdomain()));
636 auto it_this = _tdomain->begin();
637 auto it_x = x.tdomain()->cbegin();
638
639 while(it_this != _tdomain->end())
640 {
641 auto s = slice(it_this);
642 s->set(s->codomain() & x.slice(it_x)->codomain());
643 it_this++; it_x++;
644 }
645
646 assert(it_x == x.tdomain()->cend());
647 return *this;
648 }
649
657 friend inline std::ostream& operator<<(std::ostream& os, const SlicedTube<T>& x)
658 {
659 os << x.t0_tf()
660 << "->" << (x.is_empty() ? x.empty_value() : x.codomain())
661 << ", " << x.nb_slices()
662 << " slice" << (x.nb_slices() > 1 ? "s" : "")
663 << std::flush;
664 return os;
665 }
666
673 AnalyticFunction<typename ExprType<T>::Type> as_function() const
674 {
675 ScalarVar t;
676 return {{t},
677 AnalyticExprWrapper<typename ExprType<T>::Type>(
678 std::make_shared<AnalyticOperationExpr<
679 TubeOp<SlicedTube<T>>,typename ExprType<T>::Type,ScalarType>>(*this,t))
680 };
681 }
682
683 // Inversion related methods
684
688
689 template<typename Func>
690 Interval invert_common(const T& y, const Interval& t, const Func& apply_invert) const
691 {
692 assert_release(y.size() == this->size());
693
694 if(t.is_empty() || y.is_empty())
695 return Interval::empty();
696
697 else if(!t.is_subset(_tdomain->t0_tf()))
698 return Interval();
699
701 Interval t_ = t & _tdomain->t0_tf();
702
703 assert(!t_.is_empty() && !t_.is_unbounded());
704 for(auto it = _tdomain->tslice(t_.lb()) ;
705 it != _tdomain->end() && it->lb() <= t_.ub() ; it++)
706 {
707 if(!t_.is_degenerated() && it->is_gate())
708 continue;
709
710 assert(it != _tdomain->end());
711 invert |= apply_invert(it, t & *it);
712 }
713
714 return invert;
715 }
716
717 template<typename Func>
718 void invert_common_subsets(const T& y, std::vector<Interval> &v_t,
719 const Interval& t, const Func& apply_invert) const
720 {
721 assert_release(y.size() == this->size());
722 v_t.clear();
723
724 if(t.is_empty() || y.is_empty())
725 return;
726
727 else if(!t.is_subset(_tdomain->t0_tf()))
728 {
729 v_t.push_back(Interval());
730 return;
731 }
732
733 Interval invert = Interval::empty();
734 Interval t_ = t & _tdomain->t0_tf();
735
736 assert(!t_.is_empty() && !t_.is_unbounded());
737 for(auto it = _tdomain->tslice(t_.lb()) ;
738 it != _tdomain->end() && it->lb() < t_.ub() ; it++)
739 {
740 if(it->is_gate())
741 continue;
742
743 assert(it != _tdomain->end());
744 Interval local_invert = apply_invert(it, t & *it);
745
746 if(local_invert.is_empty() && !invert.is_empty())
747 {
748 v_t.push_back(invert);
749 invert.set_empty();
750 }
751
752 else
753 invert |= local_invert;
754 }
755
756 if(!invert.is_empty())
757 v_t.push_back(invert);
758 }
759
768 Interval invert(const T& y) const
769 {
770 return invert(y,t0_tf());
771 }
772
783 Interval invert(const T& y, const Interval& t) const
784 {
785 return invert_common(y, t,
786 [this,&y](auto it, const Interval& t_) {
787 return this->slice(it)->invert(y, t_);
788 });
789 }
790
798 void invert(const T& y, std::vector<Interval> &v_t) const
799 {
800 invert(y,v_t,t0_tf());
801 }
802
812 void invert(const T& y, std::vector<Interval> &v_t, const Interval& t) const
813 {
814 return invert_common_subsets(y, v_t, t,
815 [this,&y](auto it, const Interval& t_) {
816 return this->slice(it)->invert(y, t_);
817 });
818 }
819
830 Interval invert(const T& y, const SlicedTube<T>& v) const
831 requires (std::is_same_v<T,Interval> || std::is_same_v<T,IntervalVector>)
832 {
833 return invert(y,v,t0_tf());
834 }
835
848 Interval invert(const T& y, const SlicedTube<T>& v, const Interval& t) const
849 requires (std::is_same_v<T,Interval> || std::is_same_v<T,IntervalVector>)
850 {
851 return invert_common(y, t,
852 [this,&v,&y](auto it, const Interval& t_) {
853 return this->slice(it)->invert(y, *v.slice(it), t_);
854 });
855 }
856
867 void invert(const T& y, std::vector<Interval> &v_t, const SlicedTube<T>& v) const
868 requires (std::is_same_v<T,Interval> || std::is_same_v<T,IntervalVector>)
869 {
870 invert(y,v_t,v,t0_tf());
871 }
872
885 void invert(const T& y, std::vector<Interval> &v_t, const SlicedTube<T>& v, const Interval& t) const
886 requires (std::is_same_v<T,Interval> || std::is_same_v<T,IntervalVector>)
887 {
888 return invert_common_subsets(y, v_t, t,
889 [this,&v,&y](auto it, const Interval& t_) {
890 return this->slice(it)->invert(y, *v.slice(it), t_);
891 });
892 }
893
894 // Integral related methods
895
902
919 T integral(const Interval& t) const;
920
939 T integral(const Interval& t1, const Interval& t2) const;
940
965 std::pair<T,T> partial_integral(const Interval& t) const;
966
993 std::pair<T,T> partial_integral(const Interval& t1, const Interval& t2) const;
994
1010 {
1011 auto x0 = all_reals_value();
1012 x0.init(0.);
1013 return primitive(x0);
1014 }
1015
1037 inline SlicedTube<T> primitive(const T& x0) const
1038 {
1039 auto x = all_reals_value();
1040 auto p = SlicedTube<T>(this->tdomain(), x);
1041 p.set(x0, this->tdomain()->t0_tf().lb()); // may create an unwanted gate
1042 CtcDeriv c;
1043 c.contract(p,*this);
1044 return p;
1045 }
1046
1052 inline T all_reals_value() const
1053 {
1054 T x = first_slice()->codomain();
1055 x.init();
1056 return x;
1057 }
1058
1064 inline T empty_value() const
1065 {
1066 T x = first_slice()->codomain();
1067 x.set_empty();
1068 return x;
1069 }
1070
1077 inline SampledTraj<typename Scalar<T>::Type> mid() const
1078 {
1079 SampledTraj<typename Scalar<T>::Type> m;
1080 double t0 = _tdomain->t0_tf().lb();
1081 m.set((*this)(t0).mid(), t0);
1082 for(const auto& s : *this)
1083 if(!s.is_gate())
1084 m.set(s.output_gate().mid(),s.t0_tf().ub());
1085 return m;
1086 }
1087
1088
1089 public:
1090
1091 using base_container = std::list<TSlice>;
1092
1096 struct iterator : public base_container::iterator
1097 {
1098 public:
1099
1100 iterator(SlicedTube& x, base_container::iterator it)
1101 : base_container::iterator(it), _x(x) { }
1102
1103 std::shared_ptr<Slice<T>> operator->()
1104 {
1105 return _x.slice(*this);
1106 }
1107
1108 Slice<T>& operator*()
1109 {
1110 return *operator->();
1111 }
1112
1113 protected:
1114
1115 SlicedTube& _x;
1116 };
1117
1121 iterator begin() { return { *this, _tdomain->begin() }; }
1122
1126 iterator end() { return { *this, _tdomain->end() }; }
1127
1131 struct reverse_iterator : public base_container::reverse_iterator
1132 {
1133 public:
1134
1135 reverse_iterator(SlicedTube& x, base_container::reverse_iterator it)
1136 : base_container::reverse_iterator(it), _x(x) { }
1137
1138 std::shared_ptr<Slice<T>> operator->()
1139 {
1140 return _x.slice(*this);
1141 }
1142
1143 Slice<T>& operator*()
1144 {
1145 return *operator->();
1146 }
1147
1148 protected:
1149
1150 SlicedTube& _x;
1151 };
1152
1156 reverse_iterator rbegin() { return { *this, _tdomain->rbegin() }; }
1157
1161 reverse_iterator rend() { return { *this, _tdomain->rend() }; }
1162
1166 struct const_iterator : public base_container::const_iterator
1167 {
1168 public:
1169
1170 const_iterator(const SlicedTube& x, base_container::const_iterator it)
1171 : base_container::const_iterator(it), _x(x) { }
1172
1173 std::shared_ptr<const Slice<T>> operator->()
1174 {
1175 return _x.slice(*this);
1176 }
1177
1178 const Slice<T>& operator*()
1179 {
1180 return *operator->();
1181 }
1182
1183 protected:
1184
1185 const SlicedTube& _x;
1186 };
1187
1191 const_iterator begin() const { return { *this, _tdomain->cbegin() }; }
1192
1196 const_iterator end() const { return { *this, _tdomain->cend() }; }
1197
1201 struct const_reverse_iterator : public base_container::const_reverse_iterator
1202 {
1203 public:
1204
1205 const_reverse_iterator(const SlicedTube& x, base_container::const_reverse_iterator it)
1206 : base_container::const_reverse_iterator(it), _x(x) { }
1207
1208 std::shared_ptr<const Slice<T>> operator->()
1209 {
1210 return _x.slice(*this);
1211 }
1212
1213 const Slice<T>& operator*()
1214 {
1215 return *operator->();
1216 }
1217
1218 protected:
1219
1220 const SlicedTube& _x;
1221 };
1222
1226 const_reverse_iterator rbegin() const { return { *this, _tdomain->crbegin() }; }
1227
1231 const_reverse_iterator rend() const { return { *this, _tdomain->crend() }; }
1232 };
1233
1234
1235 // Template deduction guide:
1236
1237 template<typename T>
1238 SlicedTube(const std::shared_ptr<TDomain>& tdomain, const AnalyticFunction<T>& f) ->
1239 SlicedTube<typename Wrapper<T>::Domain>;
1240
1241 template<typename T>
1242 SlicedTube(const std::shared_ptr<TDomain>& tdomain, const SampledTraj<T>& f) ->
1243 SlicedTube<typename Wrapper<T>::Domain>;
1244
1245 template<typename T>
1246 SlicedTube(const std::shared_ptr<TDomain>& tdomain, const AnalyticTraj<T>& f) ->
1247 SlicedTube<typename Wrapper<T>::Domain>;
1248
1249
1250 // Ctc
1251
1252 template<typename... X>
1253 inline void CtcBase<X...>::contract(SlicedTube<X>&... x) const
1254 {
1255 auto&& x0 = std::get<0>(std::forward_as_tuple(x...));
1256 for(auto it = x0.begin(); it != x0.end(); ++it)
1257 contract((x.slice(it)->codomain())...);
1258 }
1259
1260 template<typename... X>
1261 inline void CtcBase<X...>::contract_tube(SlicedTube<X>&... x) const
1262 {
1263 std::cout << "CtcInverse::contract_tube(...) is deprecated; \
1264 use CtcInverse::contract(...) with SlicedTube arguments instead" << std::endl;
1265 return contract(x...);
1266 }
1267}
1268
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:50
bool is_unbounded() const
Tests if one of the bounds of this is infinite.
Definition codac2_Interval_impl.h:236
bool is_empty() const
Tests if this is empty.
Definition codac2_Interval_impl.h:221
double ub() const
Returns the upper bound of this.
Definition codac2_Interval_impl.h:131
bool is_degenerated() const
Tests if this is degenerated, that is, in the form of .
Definition codac2_Interval_impl.h:241
bool is_subset(const Interval &x) const
Tests if this is a subset of x.
Definition codac2_Interval_impl.h:271
double lb() const
Returns the lower bound of this.
Definition codac2_Interval_impl.h:126
static Interval empty()
Provides an empty interval.
Definition codac2_Interval_impl.h:584
Codomain of a sliced tube over one temporal slice.
Definition codac2_Slice.h:42
std::shared_ptr< const SliceBase > first_slice() const
Returns the first slice of this tube.
Definition codac2_SlicedTubeBase.h:81
size_t nb_slices() const
Returns the number of temporal elements of this tube.
Definition codac2_SlicedTubeBase.h:67
std::shared_ptr< const SliceBase > last_slice() const
Returns the last slice of this tube.
Definition codac2_SlicedTubeBase.h:97
SlicedTubeBase(const std::shared_ptr< TDomain > &tdomain)
Creates a sliced tube over a given temporal domain.
Definition codac2_SlicedTubeBase.h:43
Tube represented over a sliced temporal domain.
Definition codac2_SlicedTube.h:38
SlicedTube(const std::shared_ptr< TDomain > &tdomain, const T &codomain)
Creates a sliced tube with constant codomain over all temporal slices.
Definition codac2_SlicedTube.h:47
SlicedTube(const SlicedTube< T > &x)
Copy constructor.
Definition codac2_SlicedTube.h:130
void set(const T &codomain, double t)
Sets the codomain at one temporal instant.
Definition codac2_SlicedTube.h:465
reverse_iterator rbegin()
Returns a reverse iterator to the last temporal slice.
Definition codac2_SlicedTube.h:1156
std::pair< T, T > enclosed_bounds(const Interval &t) const
Returns enclosed lower and upper bounds over a temporal interval.
Definition codac2_SlicedTube.h:412
void invert(const T &y, std::vector< Interval > &v_t, const SlicedTube< T > &v) const
Computes the set of continuous values of the optimal inversion .
Definition codac2_SlicedTube.h:867
void set(const T &codomain)
Sets all codomains of this tube to the same value.
Definition codac2_SlicedTube.h:444
T all_reals_value() const
Returns the unbounded codomain value associated with T.
Definition codac2_SlicedTube.h:1052
void set(const T &codomain, const Interval &t)
Sets the codomain over a temporal interval.
Definition codac2_SlicedTube.h:480
virtual std::pair< Index, Index > shape() const
Returns the matrix shape of this tube codomain.
Definition codac2_SlicedTube.h:175
SlicedTube & operator=(const SlicedTube &x)
Assignment operator.
Definition codac2_SlicedTube.h:148
void invert(const T &y, std::vector< Interval > &v_t) const
Computes the set of continuous values of the inversion .
Definition codac2_SlicedTube.h:798
SlicedTube(const std::shared_ptr< TDomain > &tdomain, const AnalyticTraj< V > &x)
Creates a sliced tube by evaluating an analytic trajectory on each temporal slice.
Definition codac2_SlicedTube.h:92
iterator begin()
Returns an iterator to the first temporal slice.
Definition codac2_SlicedTube.h:1121
T operator()(const Interval &t) const
Evaluates this tube over a temporal interval.
Definition codac2_SlicedTube.h:381
std::shared_ptr< const Slice< T > > last_slice() const
Returns the last slice of this tube.
Definition codac2_SlicedTube.h:237
std::shared_ptr< Slice< T > > first_slice()
Returns the first slice of this tube.
Definition codac2_SlicedTube.h:204
T codomain() const
Returns the global codomain of this tube.
Definition codac2_SlicedTube.h:347
T empty_value() const
Returns the empty codomain value associated with T.
Definition codac2_SlicedTube.h:1064
bool is_unbounded() const
Tests whether this tube is unbounded.
Definition codac2_SlicedTube.h:332
SlicedTube(const std::shared_ptr< TDomain > &tdomain, const AnalyticFunction< typename ExprType< T >::Type > &f)
Creates a sliced tube by evaluating an analytic function on each temporal slice.
Definition codac2_SlicedTube.h:67
SlicedTube< IntervalVector > subvector(Index i, Index j) const
Extracts a subvector of this tube.
Definition codac2_SlicedTube.h:592
void set_ith_slice(const T &codomain, Index i)
Sets the codomain of the -th stored slice.
Definition codac2_SlicedTube.h:511
std::shared_ptr< const Slice< T > > slice(const std::list< TSlice >::const_iterator &it) const
Returns the slice attached to a temporal iterator.
Definition codac2_SlicedTube.h:261
reverse_iterator rend()
Returns a reverse iterator past the first temporal slice.
Definition codac2_SlicedTube.h:1161
Index size() const
Returns the codomain dimension.
Definition codac2_SlicedTube.h:163
bool is_empty() const
Tests whether this tube is empty.
Definition codac2_SlicedTube.h:316
const_reverse_iterator rend() const
Returns a constant reverse iterator past the first temporal slice.
Definition codac2_SlicedTube.h:1231
double volume() const
Returns the volume of this tube.
Definition codac2_SlicedTube.h:190
SlicedTube(const std::shared_ptr< TDomain > &tdomain, const SampledTraj< V > &x)
Creates a sliced tube from a sampled trajectory.
Definition codac2_SlicedTube.h:112
const_reverse_iterator rbegin() const
Returns a constant reverse iterator to the last temporal slice.
Definition codac2_SlicedTube.h:1226
Interval invert(const T &y) const
Returns the interval inversion .
Definition codac2_SlicedTube.h:768
SlicedTube & operator&=(const SlicedTube &x)
Intersects this tube with another one.
Definition codac2_SlicedTube.h:633
const SlicedTube< T > & inflate(const SampledTraj< V > &rad)
Inflates this tube by a time-varying sampled radius.
Definition codac2_SlicedTube.h:554
std::shared_ptr< Slice< T > > slice(const std::list< TSlice >::reverse_iterator &it)
Returns the slice attached to a reverse temporal iterator.
Definition codac2_SlicedTube.h:273
std::shared_ptr< const Slice< T > > first_slice() const
Returns the first slice of this tube.
Definition codac2_SlicedTube.h:215
iterator end()
Returns an iterator past the last temporal slice.
Definition codac2_SlicedTube.h:1126
std::shared_ptr< Slice< T > > last_slice()
Returns the last slice of this tube.
Definition codac2_SlicedTube.h:226
bool operator==(const SlicedTube &x) const
Compares two sliced tubes.
Definition codac2_SlicedTube.h:610
SlicedTube< Interval > operator[](Index i) const
Extracts one scalar component of this tube.
Definition codac2_SlicedTube.h:576
T operator()(const Interval &t, const SlicedTube< T > &v) const
Returns the optimal evaluation over a temporal interval using a derivative tube.
Definition codac2_SlicedTube.h:396
const_iterator end() const
Returns a constant iterator past the last temporal slice.
Definition codac2_SlicedTube.h:1196
std::shared_ptr< Slice< T > > slice(std::shared_ptr< TSlice > ptr)
Returns the slice attached to a temporal slice pointer.
Definition codac2_SlicedTube.h:299
Interval invert(const T &y, const SlicedTube< T > &v) const
Returns the optimal interval inversion .
Definition codac2_SlicedTube.h:830
AnalyticFunction< typename ExprType< T >::Type > as_function() const
Returns an analytic wrapper of this tube, allowing to evaluate this tube as an operator in an analyti...
Definition codac2_SlicedTube.h:673
friend std::ostream & operator<<(std::ostream &os, const SlicedTube< T > &x)
Stream output for a sliced tube.
Definition codac2_SlicedTube.h:657
const SlicedTube< T > & inflate(const V &rad)
Inflates this tube by a constant radius.
Definition codac2_SlicedTube.h:531
SampledTraj< typename Scalar< T >::Type > mid() const
Returns the approximated midpoint trajectory of this tube.
Definition codac2_SlicedTube.h:1077
std::shared_ptr< const Slice< T > > slice(const std::list< TSlice >::const_reverse_iterator &it) const
Returns the slice attached to a reverse temporal iterator.
Definition codac2_SlicedTube.h:285
std::shared_ptr< Slice< T > > slice(const std::list< TSlice >::iterator &it)
Returns the slice attached to a temporal iterator.
Definition codac2_SlicedTube.h:249
const_iterator begin() const
Returns a constant iterator to the first temporal slice.
Definition codac2_SlicedTube.h:1191
static bool are_same(const std::shared_ptr< const TDomain > &tdom1, const std::shared_ptr< const TDomain > &tdom2)
Tests whether two temporal domains share the same temporal partition.
Temporal slice shared by sliced tubes.
Definition codac2_TSlice.h:34
const std::shared_ptr< TDomain > _tdomain
Shared temporal domain of this tube.
Definition codac2_TubeBase.h:71
Interval t0_tf() const
Returns the global temporal interval of this tube.
Definition codac2_TubeBase.h:61
const std::shared_ptr< TDomain > & tdomain() const
Returns the temporal domain of this tube.
Definition codac2_TubeBase.h:49
bool is_superset(const Matrix< codac2::Interval, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks whether this matrix is a superset of another interval matrix.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:858
bool is_subset(const Matrix< codac2::Interval, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks whether this matrix is a subset of another interval matrix.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:678
auto lb() const
Returns a matrix containing the lower bounds of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:91
auto rad() const
Returns a matrix containing the radii of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:197
std::pair< T, T > partial_integral(const Interval &t) const
Returns lower and upper enclosures of the integrals of this tube from to .
Definition codac2_SlicedTube_integral_impl.h:58
SlicedTube< T > primitive() const
Returns a primitive of this tube with zero initial condition.
Definition codac2_SlicedTube.h:1009
SlicedTube< T > primitive(const T &x0) const
Returns a primitive of this tube with prescribed initial condition.
Definition codac2_SlicedTube.h:1037
T integral(const Interval &t) const
Returns an enclosure of the integrals of this tube from to .
Definition codac2_SlicedTube_integral_impl.h:17
void invert(const T &y, std::vector< Interval > &v_t, const Interval &t) const
Computes the set of continuous values of the inversion .
Definition codac2_SlicedTube.h:812
Interval invert(const T &y, const SlicedTube< T > &v, const Interval &t) const
Returns the optimal interval inversion .
Definition codac2_SlicedTube.h:848
void invert(const T &y, std::vector< Interval > &v_t, const SlicedTube< T > &v, const Interval &t) const
Computes the set of continuous values of the optimal inversion .
Definition codac2_SlicedTube.h:885
Interval invert(const T &y, const Interval &t) const
Returns the interval inversion .
Definition codac2_SlicedTube.h:783
Definition codac2_OctaSym.h:21
Eigen::Matrix< Interval,-1, 1 > IntervalVector
Alias for a dynamic-size column vector of intervals.
Definition codac2_IntervalVector.h:25
Constant iterator over the slices of this tube.
Definition codac2_SlicedTube.h:1167
Constant reverse iterator over the slices of this tube.
Definition codac2_SlicedTube.h:1202
Mutable iterator over the slices of this tube.
Definition codac2_SlicedTube.h:1097
Mutable reverse iterator over the slices of this tube.
Definition codac2_SlicedTube.h:1132