codac4matlab 2.0.0.dev25__cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. codac4matlab/__init__.py +4 -0
  2. codac4matlab/_core.cpython-314-aarch64-linux-gnu.so +0 -0
  3. codac4matlab/_graphics.cpython-314-aarch64-linux-gnu.so +0 -0
  4. codac4matlab/_unsupported.cpython-314-aarch64-linux-gnu.so +0 -0
  5. codac4matlab/core/__init__.py +588 -0
  6. codac4matlab/empty.cpython-314-aarch64-linux-gnu.so +0 -0
  7. codac4matlab/graphics/__init__.py +1 -0
  8. codac4matlab/tests/__init__.py +1 -0
  9. codac4matlab/tests/test_AnalyticFunction.py +442 -0
  10. codac4matlab/tests/test_AnalyticTraj.py +62 -0
  11. codac4matlab/tests/test_Approx.py +27 -0
  12. codac4matlab/tests/test_BoolInterval.py +96 -0
  13. codac4matlab/tests/test_Color.py +77 -0
  14. codac4matlab/tests/test_ConvexPolygon.py +300 -0
  15. codac4matlab/tests/test_CtcAction.py +30 -0
  16. codac4matlab/tests/test_CtcCartProd.py +39 -0
  17. codac4matlab/tests/test_CtcCtcBoundary.py +48 -0
  18. codac4matlab/tests/test_CtcDeriv.py +434 -0
  19. codac4matlab/tests/test_CtcEval.py +214 -0
  20. codac4matlab/tests/test_CtcFixpoint.py +65 -0
  21. codac4matlab/tests/test_CtcInter.py +39 -0
  22. codac4matlab/tests/test_CtcInverse.py +213 -0
  23. codac4matlab/tests/test_CtcInverseNotIn.py +129 -0
  24. codac4matlab/tests/test_CtcLazy.py +50 -0
  25. codac4matlab/tests/test_CtcPolygon.py +91 -0
  26. codac4matlab/tests/test_CtcSegment.py +104 -0
  27. codac4matlab/tests/test_Ellipsoid.py +20 -0
  28. codac4matlab/tests/test_GaussJordan.py +34 -0
  29. codac4matlab/tests/test_IntFullPivLU.py +84 -0
  30. codac4matlab/tests/test_Interval.py +254 -0
  31. codac4matlab/tests/test_IntervalMatrix.py +664 -0
  32. codac4matlab/tests/test_IntervalVector.py +657 -0
  33. codac4matlab/tests/test_Interval_operations.py +293 -0
  34. codac4matlab/tests/test_Matrix.py +81 -0
  35. codac4matlab/tests/test_OctaSym.py +41 -0
  36. codac4matlab/tests/test_Parallelepiped.py +35 -0
  37. codac4matlab/tests/test_Parallelepiped_eval.py +62 -0
  38. codac4matlab/tests/test_Polygon.py +120 -0
  39. codac4matlab/tests/test_SampledTraj.py +135 -0
  40. codac4matlab/tests/test_Segment.py +138 -0
  41. codac4matlab/tests/test_SepCartProd.py +34 -0
  42. codac4matlab/tests/test_SepCtcBoundary.py +52 -0
  43. codac4matlab/tests/test_SepInverse.py +104 -0
  44. codac4matlab/tests/test_SepPolygon.py +102 -0
  45. codac4matlab/tests/test_SepProj.py +39 -0
  46. codac4matlab/tests/test_SepTransform.py +41 -0
  47. codac4matlab/tests/test_Slice.py +78 -0
  48. codac4matlab/tests/test_Slice_polygon.py +208 -0
  49. codac4matlab/tests/test_SlicedTube.py +562 -0
  50. codac4matlab/tests/test_SlicedTube_integral.py +380 -0
  51. codac4matlab/tests/test_TDomain.py +115 -0
  52. codac4matlab/tests/test_Vector.py +41 -0
  53. codac4matlab/tests/test_arithmetic_add.py +54 -0
  54. codac4matlab/tests/test_arithmetic_div.py +46 -0
  55. codac4matlab/tests/test_arithmetic_mul.py +114 -0
  56. codac4matlab/tests/test_arithmetic_sub.py +54 -0
  57. codac4matlab/tests/test_capd.py +19 -0
  58. codac4matlab/tests/test_cart_prod.py +38 -0
  59. codac4matlab/tests/test_eigen.py +19 -0
  60. codac4matlab/tests/test_geometry.py +136 -0
  61. codac4matlab/tests/test_hull.py +35 -0
  62. codac4matlab/tests/test_ibex.py +19 -0
  63. codac4matlab/tests/test_inversion.py +57 -0
  64. codac4matlab/tests/test_linear_ctc.py +77 -0
  65. codac4matlab/tests/test_operators.py +377 -0
  66. codac4matlab/tests/test_peibos.py +83 -0
  67. codac4matlab/tests/test_predefined_tubes.py +193 -0
  68. codac4matlab/tests/test_serialization.py +30 -0
  69. codac4matlab/tests/test_transformations.py +61 -0
  70. codac4matlab/tests/test_trunc.py +95 -0
  71. codac4matlab/unsupported/__init__.py +1 -0
  72. codac4matlab/version.py +1 -0
  73. codac4matlab-2.0.0.dev25.dist-info/METADATA +23 -0
  74. codac4matlab-2.0.0.dev25.dist-info/RECORD +76 -0
  75. codac4matlab-2.0.0.dev25.dist-info/WHEEL +6 -0
  76. codac4matlab-2.0.0.dev25.dist-info/top_level.txt +1 -0
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env python
2
+
3
+ # Codac tests
4
+ # ----------------------------------------------------------------------------
5
+ # \date 2024
6
+ # \author Simon Rohou
7
+ # \copyright Copyright 2024 Codac Team
8
+ # \license GNU Lesser General Public License (LGPL)
9
+
10
+ import unittest
11
+ from codac import *
12
+ import sys
13
+ import math
14
+
15
+ class TestSlice(unittest.TestCase):
16
+
17
+ def test_slice_inversion(self):
18
+
19
+ tdomain = create_tdomain([0,1])
20
+ x = SlicedTube(tdomain, Interval(0,10))
21
+ sx = x.first_slice()
22
+ x.set([2,3],0)
23
+ x.set([5,6],1)
24
+ self.assertTrue(sx.invert([4,6], 0) == Interval.empty())
25
+ self.assertTrue(sx.invert([2.5,6], 0) == 0.)
26
+ self.assertTrue(sx.invert([0,1], 1) == Interval.empty())
27
+ self.assertTrue(sx.invert([2.5,6], 1) == 1.)
28
+ self.assertTrue(sx.invert([2.5,6], [0.2,0.5]) == Interval(0.2,0.5))
29
+ self.assertTrue(sx.invert([2.5,6], 0.2) == Interval(0.2))
30
+
31
+ def test_slice_inversion_unbounded_derivative(self):
32
+
33
+ tdomain = create_tdomain([0,1])
34
+ x = SlicedTube(tdomain, Interval(0,10))
35
+ v = SlicedTube(tdomain, Interval())
36
+ sx = x.first_slice()
37
+ sv = v.first_slice()
38
+ self.assertTrue(sx.invert(5., sv, sx.t0_tf()) == Interval(0,1))
39
+ self.assertTrue(sx.invert(15., sv, sx.t0_tf()) == Interval.empty())
40
+
41
+ def test_slice_inversion_other_case(self):
42
+
43
+ tdomain = create_tdomain([6.4,6.5])
44
+ x = SlicedTube(tdomain, Interval(0.759,1.205))
45
+ v = SlicedTube(tdomain, Interval(-0.216,-0.115))
46
+ sx = x.first_slice()
47
+ sv = v.first_slice()
48
+
49
+ x.set([0.781,1.205],6.4)
50
+ x.set([0.759,1.194],6.5)
51
+
52
+ ctc_deriv = CtcDeriv()
53
+ ctc_deriv.contract(x,v)
54
+
55
+ self.assertTrue(not sx.codomain().is_empty())
56
+ self.assertTrue(Approx(sx.codomain(),1e-4) == Interval(0.7594, 1.20501))
57
+ self.assertTrue(Approx(sx.output_gate(),1e-4) == Interval(0.7594, 1.19351))
58
+
59
+ p = sx.polygon_slice(sv)
60
+
61
+ self.assertTrue(Approx(p,1e-4) == ConvexPolygon([
62
+ [[6.49999, 6.5],[0.7594, 0.759401]],
63
+ [[6.49999, 6.5],[1.1935, 1.19351]],
64
+ [[6.4, 6.40001],[1.20499, 1.20501]],
65
+ [[6.4, 6.40001],[0.780999, 0.781001]]
66
+ ]))
67
+
68
+ pt = IntervalVector([sx.t0_tf().ub(),1])
69
+
70
+ self.assertTrue(p.contains(pt) == BoolInterval.UNKNOWN)
71
+ self.assertTrue(p.box()[0].ub() == sx.t0_tf().ub())
72
+
73
+ p_inter = (p&ConvexPolygon(pt))
74
+ self.assertTrue(p_inter == ConvexPolygon(pt))
75
+
76
+
77
+ if __name__ == '__main__':
78
+ unittest.main()
@@ -0,0 +1,208 @@
1
+ #!/usr/bin/env python
2
+
3
+ # Codac tests
4
+ # ----------------------------------------------------------------------------
5
+ # \date 2024
6
+ # \author Simon Rohou
7
+ # \copyright Copyright 2024 Codac Team
8
+ # \license GNU Lesser General Public License (LGPL)
9
+
10
+ import unittest
11
+ from codac import *
12
+ import sys
13
+ import math
14
+
15
+ class TestPolygonSlice(unittest.TestCase):
16
+
17
+ def test_polygon_slice_1(self):
18
+
19
+ tdomain = create_tdomain([-1,3])
20
+ x = SlicedTube(tdomain, Interval())
21
+ v = SlicedTube(tdomain, Interval(-1,1))
22
+
23
+ sx = x.first_slice()
24
+ sv = v.first_slice()
25
+
26
+ self.assertTrue(sx.t0_tf() == Interval(-1,3))
27
+ self.assertTrue(sx.codomain() == Interval())
28
+ x.set([-1,2],-1)
29
+ x.set([-2,0],3)
30
+
31
+ ctc_deriv = CtcDeriv(TimePropag.FWD_BWD, False)
32
+ ctc_deriv.contract(sx, sv)
33
+
34
+ p1 = sx.polygon_slice(sv)
35
+ self.assertTrue(p1.box()[0] == Interval(-1.,3.))
36
+ self.assertTrue(p1.box()[1] == Interval(-3.5,3.))
37
+
38
+ p2 = ConvexPolygon([ [-1,-1],[-1,2],[0,3],[3,0],[3,-2],[1.5,-3.5] ])
39
+ self.assertTrue(Approx(p1) == p2)
40
+
41
+ def test_polygon_slice_2(self):
42
+
43
+ tdomain = create_tdomain([-1,3])
44
+ x = SlicedTube(tdomain, Interval(-5,3))
45
+ v = SlicedTube(tdomain, Interval(-1))
46
+
47
+ sx = x.first_slice()
48
+ sv = v.first_slice()
49
+
50
+ x.set([-1,3],-1)
51
+ x.set([-5,0.5],3)
52
+
53
+ ctc_deriv = CtcDeriv(TimePropag.FWD_BWD, False)
54
+ ctc_deriv.contract(sx, sv)
55
+
56
+ p1 = sx.polygon_slice(sv)
57
+ self.assertTrue(p1.box()[0] == Interval(-1.,3.))
58
+ self.assertTrue(p1.box()[1] == Interval(-5,3.))
59
+
60
+ p2 = ConvexPolygon([ [-1,-1],[-1,3],[3,-1],[3,-5],[-1,1] ])
61
+ self.assertTrue(Approx(p1) == p2)
62
+
63
+ def test_polygon_slice_3(self):
64
+
65
+ tdomain = create_tdomain([-1,3])
66
+ x = SlicedTube(tdomain, Interval(-5,3))
67
+ v = SlicedTube(tdomain, Interval(-1,1))
68
+
69
+ sx = x.first_slice()
70
+ sv = v.first_slice()
71
+
72
+ x.set([1,3],-1)
73
+ x.set([-4,-3],3)
74
+
75
+ ctc_deriv = CtcDeriv(TimePropag.FWD_BWD, False)
76
+ ctc_deriv.contract(sx, sv)
77
+
78
+ p1 = sx.polygon_slice(sv)
79
+ self.assertTrue(p1.box()[0] == Interval(-1.,3.))
80
+ self.assertTrue(p1.box()[1] == Interval(-3,1.))
81
+
82
+ #DefaultFigure::draw_polygon(p1)
83
+
84
+ p2 = ConvexPolygon([ [-1,1],[3,-3] ])
85
+
86
+ self.assertTrue(Approx(p1) == p2)
87
+ self.assertTrue(p1.size() == 1)
88
+
89
+ def test_polygon_slice_4(self):
90
+
91
+ tdomain = create_tdomain([0,4])
92
+ x = SlicedTube(tdomain, Interval(-1,7))
93
+ v = SlicedTube(tdomain, Interval(-1.5,4))
94
+
95
+ sx = x.first_slice()
96
+ sv = v.first_slice()
97
+
98
+ x.set([2,3],0)
99
+ x.set([3,4],4)
100
+
101
+ ctc_deriv = CtcDeriv(TimePropag.FWD_BWD, False)
102
+ ctc_deriv.contract(sx, sv)
103
+
104
+ p1 = sx.polygon_slice(sv)
105
+ self.assertTrue(p1.box()[0] == Interval(0,4))
106
+ self.assertTrue(p1.box()[1] == Interval(-1,7))
107
+
108
+ p2 = ConvexPolygon([ [0,2],[0,3],[1,7],[2,7],[4,4],[4,3],[3,-1],[2,-1] ])
109
+ self.assertTrue(Approx(p1) == p2)
110
+
111
+ def test_polygon_slice_4b(self):
112
+
113
+ tdomain = create_tdomain([4,8])
114
+ x = SlicedTube(tdomain, Interval(-1,7))
115
+ v = SlicedTube(tdomain, Interval(-0.75,-0.5))
116
+
117
+ sx = x.first_slice()
118
+ sv = v.first_slice()
119
+
120
+ x.set([3,4],4)
121
+ x.set([1],8)
122
+
123
+ ctc_deriv = CtcDeriv(TimePropag.FWD_BWD, False)
124
+ ctc_deriv.contract(sx, sv)
125
+
126
+ p1 = sx.polygon_slice(sv)
127
+ self.assertTrue(p1.box()[0] == Interval(4,8))
128
+ self.assertTrue(p1.box()[1] == Interval(1,4))
129
+
130
+ #DefaultFigure::draw_polygon(p1)
131
+
132
+ p2 = ConvexPolygon([ [4,3],[4,4],[8,1] ])
133
+ self.assertTrue(Approx(p1,1e-10) == p2)
134
+
135
+ def test_polygon_slice_5(self):
136
+
137
+ tdomain = create_tdomain([8,12])
138
+ x = SlicedTube(tdomain, Interval(-1,7))
139
+ v = SlicedTube(tdomain, Interval(-1./3.,1))
140
+
141
+ sx = x.first_slice()
142
+ sv = v.first_slice()
143
+
144
+ x.set([1],8)
145
+ x.set([1],12)
146
+
147
+ ctc_deriv = CtcDeriv(TimePropag.FWD_BWD, False)
148
+ ctc_deriv.contract(sx, sv)
149
+
150
+ p1 = sx.polygon_slice(sv)
151
+ self.assertTrue(p1.box()[0] == Interval(8,12))
152
+ self.assertTrue(Approx(p1.box()[1]) == Interval(0,2))
153
+
154
+ #DefaultFigure::draw_polygon(p1)
155
+
156
+ p2 = ConvexPolygon([ [8,1],[9,2],[12,1],[11,0] ])
157
+ self.assertTrue(Approx(p1,1e-10) == p2)
158
+
159
+ def test_polygon_slice_6(self):
160
+
161
+ tdomain = create_tdomain([12,14])
162
+ x = SlicedTube(tdomain, Interval(-1,7))
163
+ v = SlicedTube(tdomain, Interval(4.5)/2)
164
+
165
+ sx = x.first_slice()
166
+ sv = v.first_slice()
167
+
168
+ x.set([1],12)
169
+ x.set([5.5],14)
170
+
171
+ ctc_deriv = CtcDeriv(TimePropag.FWD_BWD, False)
172
+ ctc_deriv.contract(sx, sv)
173
+
174
+ p1 = sx.polygon_slice(sv)
175
+ self.assertTrue(p1.box()[0] == Interval(12,14))
176
+ self.assertTrue(Approx(p1.box()[1]) == Interval(1,5.5))
177
+
178
+ #DefaultFigure::draw_polygon(p1)
179
+
180
+ p2 = ConvexPolygon([ [12,1],[14,5.5] ])
181
+ self.assertTrue(Approx(p1,1e-10) == p2)
182
+
183
+ def test_polygon_from_tubint_paper(self):
184
+
185
+ tdomain = create_tdomain([4,5])
186
+ x = SlicedTube(tdomain, (Interval(7)/2)|(Interval(17)/4))
187
+ v = SlicedTube(tdomain, (-Interval(1)/2)|(Interval(1)/2))
188
+
189
+ sx = x.first_slice()
190
+ sv = v.first_slice()
191
+
192
+ x.set((Interval(7)/2)|4,4)
193
+ x.set([4],5)
194
+
195
+ p = sx.polygon_slice(sv);
196
+ self.assertTrue(p == ConvexPolygon([[4,4],[4,3.5],[5,4],[4.5,4.25]]))
197
+
198
+ ctc_deriv = CtcDeriv(TimePropag.FWD_BWD, False)
199
+ ctc_deriv.contract(sx,sv)
200
+ p = sx.polygon_slice(sv);
201
+ self.assertTrue(p == ConvexPolygon([[4,4],[4,3.5],[5,4],[4.5,4.25]]))
202
+
203
+ y = Interval(41)/10
204
+ self.assertTrue(Approx(x.invert(y, v, x.tdomain().t0_tf()),1e-10) == ((Interval(21)/5)|(Interval(24)/5)))
205
+
206
+
207
+ if __name__ == '__main__':
208
+ unittest.main()