open-space-toolkit-mathematics 4.5.3__py312-none-manylinux2014_x86_64.whl → 4.5.4__py312-none-manylinux2014_x86_64.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.
Potentially problematic release.
This version of open-space-toolkit-mathematics might be problematic. Click here for more details.
- {open_space_toolkit_mathematics-4.5.3.dist-info → open_space_toolkit_mathematics-4.5.4.dist-info}/METADATA +1 -1
- {open_space_toolkit_mathematics-4.5.3.dist-info → open_space_toolkit_mathematics-4.5.4.dist-info}/RECORD +17 -17
- ostk/mathematics/OpenSpaceToolkitMathematicsPy.cpython-312-x86_64-linux-gnu.so +0 -0
- ostk/mathematics/curve_fitting/__init__.pyi +97 -7
- ostk/mathematics/curve_fitting/interpolator.pyi +204 -16
- ostk/mathematics/geometry/__init__.pyi +364 -32
- ostk/mathematics/geometry/d2/__init__.pyi +560 -48
- ostk/mathematics/geometry/d2/object.pyi +1524 -126
- ostk/mathematics/geometry/d3/__init__.pyi +772 -80
- ostk/mathematics/geometry/d3/object.pyi +3164 -250
- ostk/mathematics/geometry/d3/transformation/rotation.pyi +1007 -91
- ostk/mathematics/libopen-space-toolkit-mathematics.so.4 +0 -0
- ostk/mathematics/object.pyi +292 -22
- ostk/mathematics/solver.pyi +220 -16
- {open_space_toolkit_mathematics-4.5.3.dist-info → open_space_toolkit_mathematics-4.5.4.dist-info}/WHEEL +0 -0
- {open_space_toolkit_mathematics-4.5.3.dist-info → open_space_toolkit_mathematics-4.5.4.dist-info}/top_level.txt +0 -0
- {open_space_toolkit_mathematics-4.5.3.dist-info → open_space_toolkit_mathematics-4.5.4.dist-info}/zip-safe +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
ostk/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
|
|
2
|
-
ostk/mathematics/OpenSpaceToolkitMathematicsPy.cpython-312-x86_64-linux-gnu.so,sha256=
|
|
2
|
+
ostk/mathematics/OpenSpaceToolkitMathematicsPy.cpython-312-x86_64-linux-gnu.so,sha256=BdfIZjnurUkT2zRufKjuyGhNCAA6-vwm5iJ7-WfAwfI,2287480
|
|
3
3
|
ostk/mathematics/__init__.py,sha256=U81I6jh2hIPyuT4dtZjNcLi-CQ8yXIvtFn32tVK1YCY,92
|
|
4
4
|
ostk/mathematics/__init__.pyi,sha256=J_InNBNyrZgyfVQ-r8PVZq37Wb9kM0acE4BZW2Jwo14,484
|
|
5
|
-
ostk/mathematics/libopen-space-toolkit-mathematics.so.4,sha256=
|
|
6
|
-
ostk/mathematics/object.pyi,sha256=
|
|
7
|
-
ostk/mathematics/solver.pyi,sha256=
|
|
8
|
-
ostk/mathematics/curve_fitting/__init__.pyi,sha256=
|
|
9
|
-
ostk/mathematics/curve_fitting/interpolator.pyi,sha256=
|
|
10
|
-
ostk/mathematics/geometry/__init__.pyi,sha256=
|
|
11
|
-
ostk/mathematics/geometry/d2/__init__.pyi,sha256=
|
|
12
|
-
ostk/mathematics/geometry/d2/object.pyi,sha256=
|
|
13
|
-
ostk/mathematics/geometry/d3/__init__.pyi,sha256=
|
|
14
|
-
ostk/mathematics/geometry/d3/object.pyi,sha256=
|
|
5
|
+
ostk/mathematics/libopen-space-toolkit-mathematics.so.4,sha256=bbMIUEJE6yug3B5T8JgHV8GwZaNRS_9l6yPQ1opTyvQ,91672408
|
|
6
|
+
ostk/mathematics/object.pyi,sha256=LvzjdseOx-IFv9viLEk-HXZ0GvEiERm6IbACHsVlsIk,16911
|
|
7
|
+
ostk/mathematics/solver.pyi,sha256=65dIAcfMVhWL-32ZeZI_Mb5VRqpDcjLkvrQElQZ04Ws,16067
|
|
8
|
+
ostk/mathematics/curve_fitting/__init__.pyi,sha256=IwJimnlynre4O-6tuIOC_t0kYEWTHQGMN4K9e6nGOO0,6436
|
|
9
|
+
ostk/mathematics/curve_fitting/interpolator.pyi,sha256=Pi50YICu9h8mCl9xRB2-OcsdI6NpGF-BnnqkePeHF6g,10800
|
|
10
|
+
ostk/mathematics/geometry/__init__.pyi,sha256=MDlOaEflUrXapczgfBoVCNJfDmKshUqle_reFyqG8mU,19131
|
|
11
|
+
ostk/mathematics/geometry/d2/__init__.pyi,sha256=N9AEvpz3sLOOYdCK3UrvpcbVnVzY9tRbiM1HBSsc3K4,32839
|
|
12
|
+
ostk/mathematics/geometry/d2/object.pyi,sha256=2RCR6SY12bc0daKS7lfX6wspQYR-z6m7AOEwpH0QrdY,77633
|
|
13
|
+
ostk/mathematics/geometry/d3/__init__.pyi,sha256=ivpeJQdCqEonp6nzEe6ttRz1Bd1iUD3OvceiUXpVIyk,39850
|
|
14
|
+
ostk/mathematics/geometry/d3/object.pyi,sha256=5xN55Dy_nLlUwOI1vxl7-iVnRWtY5SErEF6fU8BXcZA,160470
|
|
15
15
|
ostk/mathematics/geometry/d3/transformation/__init__.pyi,sha256=wjoTgfldZsg2a26-4iRZd_FyMFFWRYa2FfQmm55-4b0,81
|
|
16
|
-
ostk/mathematics/geometry/d3/transformation/rotation.pyi,sha256=
|
|
16
|
+
ostk/mathematics/geometry/d3/transformation/rotation.pyi,sha256=qGrVLf5ZD9vajuCidEJ2WUCp6FKhXaWdqCLjXJCmpgM,54986
|
|
17
17
|
ostk/mathematics/test/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
|
|
18
18
|
ostk/mathematics/test/test_object.py,sha256=WtksTu9zz8_UNkQYKLO64nNBFDBkRWM_DXFuAWTdKUM,1027
|
|
19
19
|
ostk/mathematics/test/curve_fitting/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-IfK3IlNPijE,21
|
|
@@ -61,8 +61,8 @@ ostk/mathematics/test/object/__init__.py,sha256=epnVn2PwdQkUDZ1msqBRO5nEZIOUBIq-
|
|
|
61
61
|
ostk/mathematics/test/object/test_interval.py,sha256=rf7tL-m76inO18rzxopkWrk-cSjKhoN5xXek6e53wAU,21708
|
|
62
62
|
ostk/mathematics/test/object/test_vector.py,sha256=5MG3s8vhgoGKAIc5GzswlZObyIrJDIPNtsEd5wNORPU,76
|
|
63
63
|
ostk/mathematics/test/solver/test_numerical_solver.py,sha256=NS9XS6Z2dBzeKnUBiIflObGzd5DM1KVAoH1SBd3DXDc,5700
|
|
64
|
-
open_space_toolkit_mathematics-4.5.
|
|
65
|
-
open_space_toolkit_mathematics-4.5.
|
|
66
|
-
open_space_toolkit_mathematics-4.5.
|
|
67
|
-
open_space_toolkit_mathematics-4.5.
|
|
68
|
-
open_space_toolkit_mathematics-4.5.
|
|
64
|
+
open_space_toolkit_mathematics-4.5.4.dist-info/METADATA,sha256=aOu9a6lgBpc0qYUcVQlQLYZ5gKrpWGcZ8jzqOaFsLsE,1804
|
|
65
|
+
open_space_toolkit_mathematics-4.5.4.dist-info/WHEEL,sha256=tvQN4EssnAByDSzh20GD_9hfZWs7a8R0KWC1BBXumw0,110
|
|
66
|
+
open_space_toolkit_mathematics-4.5.4.dist-info/top_level.txt,sha256=zOR18699uDYnafgarhL8WU_LmTZY_5NVqutv-flp_x4,5
|
|
67
|
+
open_space_toolkit_mathematics-4.5.4.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
68
|
+
open_space_toolkit_mathematics-4.5.4.dist-info/RECORD,,
|
|
Binary file
|
|
@@ -46,20 +46,110 @@ class Interpolator:
|
|
|
46
46
|
...
|
|
47
47
|
@staticmethod
|
|
48
48
|
def generate_interpolator(interpolation_type: Interpolator.Type, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) -> Interpolator:
|
|
49
|
-
|
|
49
|
+
"""
|
|
50
|
+
Generate an interpolator of specified type with data points.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
interpolation_type (Interpolator.Type): The type of interpolation.
|
|
54
|
+
x (np.array): The x-coordinates of data points.
|
|
55
|
+
y (np.array): The y-coordinates of data points.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
Interpolator: The created interpolator.
|
|
59
|
+
|
|
60
|
+
Example:
|
|
61
|
+
>>> x = np.array([0.0, 1.0, 2.0])
|
|
62
|
+
>>> y = np.array([0.0, 2.0, 4.0])
|
|
63
|
+
>>> interpolator = Interpolator.generate_interpolator(
|
|
64
|
+
... Interpolator.Type.CubicSpline, x, y
|
|
65
|
+
... )
|
|
66
|
+
"""
|
|
50
67
|
def __init__(self, interpolation_type: Interpolator.Type) -> None:
|
|
51
|
-
|
|
68
|
+
"""
|
|
69
|
+
Create an interpolator of specified type.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
interpolation_type (Interpolator.Type): The type of interpolation method.
|
|
73
|
+
|
|
74
|
+
Example:
|
|
75
|
+
>>> interpolator = Interpolator(Interpolator.Type.Linear)
|
|
76
|
+
"""
|
|
52
77
|
@typing.overload
|
|
53
78
|
def compute_derivative(self, x: float) -> float:
|
|
54
|
-
|
|
79
|
+
"""
|
|
80
|
+
Compute the derivative of the interpolation at a single point.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
x (float): The x-coordinate to compute derivative at.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
float: The derivative value.
|
|
87
|
+
|
|
88
|
+
Example:
|
|
89
|
+
>>> interpolator = Interpolator.generate_interpolator(
|
|
90
|
+
... Interpolator.Type.Linear, [0.0, 1.0], [0.0, 2.0]
|
|
91
|
+
... )
|
|
92
|
+
>>> derivative = interpolator.compute_derivative(0.5) # 2.0
|
|
93
|
+
"""
|
|
55
94
|
@typing.overload
|
|
56
95
|
def compute_derivative(self, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]:
|
|
57
|
-
|
|
96
|
+
"""
|
|
97
|
+
Compute the derivative of the interpolation at multiple points.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
x (np.array): The x-coordinates to compute derivatives at.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
(np.array): The derivative values.
|
|
104
|
+
|
|
105
|
+
Example:
|
|
106
|
+
>>> interpolator = Interpolator.generate_interpolator(
|
|
107
|
+
... Interpolator.Type.Linear, [0.0, 1.0], [0.0, 2.0]
|
|
108
|
+
... )
|
|
109
|
+
>>> derivatives = interpolator.compute_derivative([0.2, 0.8])
|
|
110
|
+
"""
|
|
58
111
|
@typing.overload
|
|
59
112
|
def evaluate(self, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]:
|
|
60
|
-
|
|
113
|
+
"""
|
|
114
|
+
Evaluate the interpolation at multiple points.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
x (np.array): The x-coordinates to evaluate at.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
(np.array): The interpolated y-values.
|
|
121
|
+
|
|
122
|
+
Example:
|
|
123
|
+
>>> interpolator = Interpolator.generate_interpolator(
|
|
124
|
+
... Interpolator.Type.Linear, [0.0, 1.0], [0.0, 2.0]
|
|
125
|
+
... )
|
|
126
|
+
>>> result = interpolator.evaluate([0.5, 1.5])
|
|
127
|
+
"""
|
|
61
128
|
@typing.overload
|
|
62
129
|
def evaluate(self, x: float) -> float:
|
|
63
|
-
|
|
130
|
+
"""
|
|
131
|
+
Evaluate the interpolation at a single point.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
x (float): The x-coordinate to evaluate at.
|
|
135
|
+
|
|
136
|
+
Returns:
|
|
137
|
+
float: The interpolated y-value.
|
|
138
|
+
|
|
139
|
+
Example:
|
|
140
|
+
>>> interpolator = Interpolator.generate_interpolator(
|
|
141
|
+
... Interpolator.Type.Linear, [0.0, 1.0], [0.0, 2.0]
|
|
142
|
+
... )
|
|
143
|
+
>>> result = interpolator.evaluate(0.5) # 1.0
|
|
144
|
+
"""
|
|
64
145
|
def get_interpolation_type(self) -> Interpolator.Type:
|
|
65
|
-
|
|
146
|
+
"""
|
|
147
|
+
Get the interpolation type of this interpolator.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
Interpolator.Type: The interpolation type.
|
|
151
|
+
|
|
152
|
+
Example:
|
|
153
|
+
>>> interpolator = Interpolator(Interpolator.Type.CubicSpline)
|
|
154
|
+
>>> type = interpolator.get_interpolation_type()
|
|
155
|
+
"""
|
|
@@ -6,50 +6,238 @@ import typing
|
|
|
6
6
|
__all__ = ['BarycentricRational', 'CubicSpline', 'Linear']
|
|
7
7
|
class BarycentricRational(ostk.mathematics.curve_fitting.Interpolator):
|
|
8
8
|
def __init__(self, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) -> None:
|
|
9
|
-
|
|
9
|
+
"""
|
|
10
|
+
Create a barycentric rational interpolator with data points.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
x (np.array): The x-coordinates of data points.
|
|
14
|
+
y (np.array): The y-coordinates of data points.
|
|
15
|
+
|
|
16
|
+
Example:
|
|
17
|
+
>>> x = np.array([0.0, 1.0, 2.0, 3.0])
|
|
18
|
+
>>> y = np.array([1.0, 2.0, 0.5, 3.0])
|
|
19
|
+
>>> interpolator = BarycentricRational(x, y)
|
|
20
|
+
"""
|
|
10
21
|
@typing.overload
|
|
11
22
|
def compute_derivative(self, x: float) -> float:
|
|
12
|
-
|
|
23
|
+
"""
|
|
24
|
+
Compute the derivative of the barycentric rational interpolation at a single point.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
x (float): The x-coordinate to compute derivative at.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
float: The derivative value.
|
|
31
|
+
|
|
32
|
+
Example:
|
|
33
|
+
>>> interpolator = BarycentricRational([0.0, 1.0, 2.0], [1.0, 2.0, 0.5])
|
|
34
|
+
>>> derivative = interpolator.compute_derivative(0.5)
|
|
35
|
+
"""
|
|
13
36
|
@typing.overload
|
|
14
37
|
def compute_derivative(self, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]:
|
|
15
|
-
|
|
38
|
+
"""
|
|
39
|
+
Compute the derivative of the barycentric rational interpolation at multiple points.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
x (np.array): The x-coordinates to compute derivatives at.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
(np.array): The derivative values.
|
|
46
|
+
|
|
47
|
+
Example:
|
|
48
|
+
>>> interpolator = BarycentricRational([0.0, 1.0, 2.0], [1.0, 2.0, 0.5])
|
|
49
|
+
>>> derivatives = interpolator.compute_derivative([0.2, 0.8])
|
|
50
|
+
"""
|
|
16
51
|
@typing.overload
|
|
17
52
|
def evaluate(self, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]:
|
|
18
|
-
|
|
53
|
+
"""
|
|
54
|
+
Evaluate the barycentric rational interpolation at multiple points.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
x (np.array): The x-coordinates to evaluate at.
|
|
58
|
+
|
|
59
|
+
Returns:
|
|
60
|
+
(np.array): The interpolated y-values.
|
|
61
|
+
|
|
62
|
+
Example:
|
|
63
|
+
>>> interpolator = BarycentricRational([0.0, 1.0, 2.0], [1.0, 2.0, 0.5])
|
|
64
|
+
>>> result = interpolator.evaluate([0.5, 1.5])
|
|
65
|
+
"""
|
|
19
66
|
@typing.overload
|
|
20
67
|
def evaluate(self, x: float) -> float:
|
|
21
|
-
|
|
68
|
+
"""
|
|
69
|
+
Evaluate the barycentric rational interpolation at a single point.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
x (float): The x-coordinate to evaluate at.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
float: The interpolated y-value.
|
|
76
|
+
|
|
77
|
+
Example:
|
|
78
|
+
>>> interpolator = BarycentricRational([0.0, 1.0, 2.0], [1.0, 2.0, 0.5])
|
|
79
|
+
>>> result = interpolator.evaluate(0.5)
|
|
80
|
+
"""
|
|
22
81
|
class CubicSpline(ostk.mathematics.curve_fitting.Interpolator):
|
|
23
82
|
@typing.overload
|
|
24
83
|
def __init__(self, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) -> None:
|
|
25
|
-
|
|
84
|
+
"""
|
|
85
|
+
Create a cubic spline interpolator with data points.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
x (np.array): The x-coordinates of data points.
|
|
89
|
+
y (np.array): The y-coordinates of data points.
|
|
90
|
+
|
|
91
|
+
Example:
|
|
92
|
+
>>> x = np.array([0.0, 1.0, 2.0, 3.0])
|
|
93
|
+
>>> y = np.array([0.0, 1.0, 4.0, 9.0])
|
|
94
|
+
>>> interpolator = CubicSpline(x, y)
|
|
95
|
+
"""
|
|
26
96
|
@typing.overload
|
|
27
97
|
def __init__(self, y: numpy.ndarray[numpy.float64[m, 1]], x_0: ostk.core.type.Real, h: ostk.core.type.Real) -> None:
|
|
28
|
-
|
|
98
|
+
"""
|
|
99
|
+
Create a cubic spline interpolator with uniform spacing.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
y (np.array): The y-coordinates of data points.
|
|
103
|
+
x_0 (float): The starting x-coordinate.
|
|
104
|
+
h (float): The uniform spacing between x-coordinates.
|
|
105
|
+
|
|
106
|
+
Example:
|
|
107
|
+
>>> y = np.array([0.0, 1.0, 4.0, 9.0])
|
|
108
|
+
>>> interpolator = CubicSpline(y, 0.0, 1.0) # x = [0, 1, 2, 3]
|
|
109
|
+
"""
|
|
29
110
|
@typing.overload
|
|
30
111
|
def compute_derivative(self, x: float) -> float:
|
|
31
|
-
|
|
112
|
+
"""
|
|
113
|
+
Compute the derivative of the cubic spline at a single point.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
x (float): The x-coordinate to compute derivative at.
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
float: The derivative value.
|
|
120
|
+
|
|
121
|
+
Example:
|
|
122
|
+
>>> interpolator = CubicSpline([0.0, 1.0, 2.0], [0.0, 1.0, 4.0])
|
|
123
|
+
>>> derivative = interpolator.compute_derivative(0.5)
|
|
124
|
+
"""
|
|
32
125
|
@typing.overload
|
|
33
126
|
def compute_derivative(self, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]:
|
|
34
|
-
|
|
127
|
+
"""
|
|
128
|
+
Compute the derivative of the cubic spline at multiple points.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
x (np.array): The x-coordinates to compute derivatives at.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
(np.array): The derivative values.
|
|
135
|
+
|
|
136
|
+
Example:
|
|
137
|
+
>>> interpolator = CubicSpline([0.0, 1.0, 2.0], [0.0, 1.0, 4.0])
|
|
138
|
+
>>> derivatives = interpolator.compute_derivative([0.2, 0.8])
|
|
139
|
+
"""
|
|
35
140
|
@typing.overload
|
|
36
141
|
def evaluate(self, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]:
|
|
37
|
-
|
|
142
|
+
"""
|
|
143
|
+
Evaluate the cubic spline interpolation at multiple points.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
x (np.array): The x-coordinates to evaluate at.
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
(np.array): The interpolated y-values.
|
|
150
|
+
|
|
151
|
+
Example:
|
|
152
|
+
>>> interpolator = CubicSpline([0.0, 1.0, 2.0], [0.0, 1.0, 4.0])
|
|
153
|
+
>>> result = interpolator.evaluate([0.5, 1.5])
|
|
154
|
+
"""
|
|
38
155
|
@typing.overload
|
|
39
156
|
def evaluate(self, x: float) -> float:
|
|
40
|
-
|
|
157
|
+
"""
|
|
158
|
+
Evaluate the cubic spline interpolation at a single point.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
x (float): The x-coordinate to evaluate at.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
float: The interpolated y-value.
|
|
165
|
+
|
|
166
|
+
Example:
|
|
167
|
+
>>> interpolator = CubicSpline([0.0, 1.0, 2.0], [0.0, 1.0, 4.0])
|
|
168
|
+
>>> result = interpolator.evaluate(0.5)
|
|
169
|
+
"""
|
|
41
170
|
class Linear(ostk.mathematics.curve_fitting.Interpolator):
|
|
42
171
|
def __init__(self, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]]) -> None:
|
|
43
|
-
|
|
172
|
+
"""
|
|
173
|
+
Create a linear interpolator with data points.
|
|
174
|
+
|
|
175
|
+
Args:
|
|
176
|
+
x (np.array): The x-coordinates of data points.
|
|
177
|
+
y (np.array): The y-coordinates of data points.
|
|
178
|
+
|
|
179
|
+
Example:
|
|
180
|
+
>>> x = np.array([0.0, 1.0, 2.0])
|
|
181
|
+
>>> y = np.array([0.0, 2.0, 4.0])
|
|
182
|
+
>>> interpolator = Linear(x, y)
|
|
183
|
+
"""
|
|
44
184
|
@typing.overload
|
|
45
185
|
def compute_derivative(self, x: float) -> float:
|
|
46
|
-
|
|
186
|
+
"""
|
|
187
|
+
Compute the derivative of the linear interpolation at a single point.
|
|
188
|
+
|
|
189
|
+
Args:
|
|
190
|
+
x (float): The x-coordinate to compute derivative at.
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
float: The derivative value.
|
|
194
|
+
|
|
195
|
+
Example:
|
|
196
|
+
>>> interpolator = Linear([0.0, 1.0], [0.0, 2.0])
|
|
197
|
+
>>> derivative = interpolator.compute_derivative(0.5) # 2.0
|
|
198
|
+
"""
|
|
47
199
|
@typing.overload
|
|
48
200
|
def compute_derivative(self, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]:
|
|
49
|
-
|
|
201
|
+
"""
|
|
202
|
+
Compute the derivative of the linear interpolation at multiple points.
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
x (np.array): The x-coordinates to compute derivatives at.
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
(np.array): The derivative values.
|
|
209
|
+
|
|
210
|
+
Example:
|
|
211
|
+
>>> interpolator = Linear([0.0, 1.0], [0.0, 2.0])
|
|
212
|
+
>>> derivatives = interpolator.compute_derivative([0.2, 0.8])
|
|
213
|
+
"""
|
|
50
214
|
@typing.overload
|
|
51
215
|
def evaluate(self, x: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[numpy.float64[m, 1]]:
|
|
52
|
-
|
|
216
|
+
"""
|
|
217
|
+
Evaluate the linear interpolation at multiple points.
|
|
218
|
+
|
|
219
|
+
Args:
|
|
220
|
+
x (np.array): The x-coordinates to evaluate at.
|
|
221
|
+
|
|
222
|
+
Returns:
|
|
223
|
+
(np.array): The interpolated y-values.
|
|
224
|
+
|
|
225
|
+
Example:
|
|
226
|
+
>>> interpolator = Linear([0.0, 1.0], [0.0, 2.0])
|
|
227
|
+
>>> result = interpolator.evaluate([0.5, 1.5])
|
|
228
|
+
"""
|
|
53
229
|
@typing.overload
|
|
54
230
|
def evaluate(self, x: float) -> float:
|
|
55
|
-
|
|
231
|
+
"""
|
|
232
|
+
Evaluate the linear interpolation at a single point.
|
|
233
|
+
|
|
234
|
+
Args:
|
|
235
|
+
x (float): The x-coordinate to evaluate at.
|
|
236
|
+
|
|
237
|
+
Returns:
|
|
238
|
+
float: The interpolated y-value.
|
|
239
|
+
|
|
240
|
+
Example:
|
|
241
|
+
>>> interpolator = Linear([0.0, 1.0], [0.0, 2.0])
|
|
242
|
+
>>> result = interpolator.evaluate(0.5) # 1.0
|
|
243
|
+
"""
|