1010
1111__all__ = ['odr' ]
1212
13- Float64Vector = NDArray [np .float64 ]
14- Float64Array = NDArray [np .float64 ]
15- Int32Vector = NDArray [np .int32 ]
16- Int32Array = NDArray [np .int32 ]
1713
18-
19- def odr (f : Callable [[Float64Vector , Float64Array ], Float64Array ],
20- beta0 : Float64Vector ,
21- y : Float64Array ,
22- x : Float64Array ,
14+ def odr (f : Callable [[NDArray [np .float64 ], NDArray [np .float64 ]], NDArray [np .float64 ]],
15+ beta0 : NDArray [np .float64 ],
16+ y : NDArray [np .float64 ],
17+ x : NDArray [np .float64 ],
2318 * ,
24- we : float | Float64Array | None = None ,
25- wd : float | Float64Array | None = None ,
26- fjacb : Callable [[Float64Vector , Float64Array ], Float64Array ] | None = None ,
27- fjacd : Callable [[Float64Vector , Float64Array ], Float64Array ] | None = None ,
28- ifixb : Int32Vector | None = None ,
29- ifixx : Int32Array | None = None ,
30- delta0 : Float64Array | None = None ,
31- lower : Float64Vector | None = None ,
32- upper : Float64Vector | None = None ,
19+ we : float | NDArray [np .float64 ] | None = None ,
20+ wd : float | NDArray [np .float64 ] | None = None ,
21+ fjacb : Callable [[NDArray [np .float64 ], NDArray [np .float64 ]],
22+ NDArray [np .float64 ]] | None = None ,
23+ fjacd : Callable [[NDArray [np .float64 ], NDArray [np .float64 ]],
24+ NDArray [np .float64 ]] | None = None ,
25+ ifixb : NDArray [np .int32 ] | None = None ,
26+ ifixx : NDArray [np .int32 ] | None = None ,
27+ delta0 : NDArray [np .float64 ] | None = None ,
28+ lower : NDArray [np .float64 ] | None = None ,
29+ upper : NDArray [np .float64 ] | None = None ,
3330 job : int = 0 ,
3431 iprint : int | None = 0 ,
3532 rptfile : str | None = None ,
@@ -39,37 +36,37 @@ def odr(f: Callable[[Float64Vector, Float64Array], Float64Array],
3936 sstol : float | None = None ,
4037 partol : float | None = None ,
4138 maxit : int | None = None ,
42- stpb : Float64Vector | None = None ,
43- stpd : Float64Array | None = None ,
44- sclb : Float64Vector | None = None ,
45- scld : Float64Array | None = None ,
46- work : Float64Vector | None = None ,
47- iwork : Int32Vector | None = None ,
39+ stpb : NDArray [ np . float64 ] | None = None ,
40+ stpd : NDArray [ np . float64 ] | None = None ,
41+ sclb : NDArray [ np . float64 ] | None = None ,
42+ scld : NDArray [ np . float64 ] | None = None ,
43+ work : NDArray [ np . float64 ] | None = None ,
44+ iwork : NDArray [ np . int32 ] | None = None ,
4845 ) -> OdrResult :
4946 r"""Solve a weighted orthogonal distance regression (ODR) problem, also
5047 known as errors-in-variables regression.
5148
5249 Parameters
5350 ----------
54- f : Callable[[Float64Vector, Float64Array], Float64Array ]
51+ f : Callable[[NDArray[np.float64], NDArray[np.float64]], NDArray[np.float64] ]
5552 Function to be fitted, with the signature `f(beta, x)`. It must return
5653 an array with the same shape as `y`.
57- beta0 : Float64Vector
54+ beta0 : NDArray[np.float64]
5855 Array of shape `(npar,)` with the initial guesses of the model parameters,
5956 within the bounds specified by arguments `lower` and `upper` (if they are
6057 specified).
61- y : Float64Array
58+ y : NDArray[np.float64]
6259 Array of shape `(n,)` or `(nq, n)` containing the values of the response
6360 variable(s). When the model is explicit, the user must specify a value
6461 for each element of `y`. If some responses of some observations are
6562 actually missing, then the user can set the corresponding weight in
6663 argument `we` to zero in order to remove the effect of the missing
6764 observation from the analysis. When the model is implicit, `y` is not
6865 referenced.
69- x : Float64Array
66+ x : NDArray[np.float64]
7067 Array of shape `(n,)` or `(m, n)` containing the values of the explanatory
7168 variable(s).
72- we : float | Float64Array | None
69+ we : float | NDArray[np.float64] | None
7370 Scalar or array specifying how the errors on `y` are to be weighted.
7471 If `we` is a scalar, then it is used for all data points. If `we` is
7572 an array of shape `(n,)` and `nq==1`, then `we[i]` represents the weight
@@ -83,7 +80,7 @@ def odr(f: Callable[[Float64Vector, Float64Array], Float64Array],
8380 `y[:, i]`. For a comprehensive description of the options, refer to page
8481 25 of the ODRPACK95 guide. By default, `we` is set to one for all `y`
8582 data points.
86- wd : float | Float64Array | None
83+ wd : float | NDArray[np.float64] | None
8784 Scalar or array specifying how the errors on `x` are to be weighted.
8885 If `wd` is a scalar, then it is used for all data points. If `wd` is
8986 an array of shape `(n,)` and `m==1`, then `wd[i]` represents the weight
@@ -97,41 +94,41 @@ def odr(f: Callable[[Float64Vector, Float64Array], Float64Array],
9794 `x[:, i]`. For a comprehensive description of the options, refer to page
9895 26 of the ODRPACK95 guide. By default, `wd` is set to one for all `x`
9996 data points.
100- fjacb : Callable[[Float64Vector, Float64Array], Float64Array ] | None
97+ fjacb : Callable[[NDArray[np.float64], NDArray[np.float64]], NDArray[np.float64] ] | None
10198 Jacobian of the function to be fitted with respect to `beta`, with the
10299 signature `fjacb(beta, x)`. It must return an array with shape
103100 `(n, npar, nq)` or compatible. To activate this option, `job` must be
104101 set accordingly. By default, the Jacobian is evaluated numerically
105102 according to the finite difference scheme defined in `job`.
106- fjacd : Callable[[Float64Vector, Float64Array], Float64Array ] | None
103+ fjacd : Callable[[NDArray[np.float64], NDArray[np.float64]], NDArray[np.float64] ] | None
107104 Jacobian of the function to be fitted with respect to `delta`, with the
108105 signature `fjacd(beta, x)`. It must return an array with shape
109106 `(n, m, nq)` or compatible. To activate this option, `job` must be
110107 set accordingly. By default, the Jacobian is evaluated numerically
111108 according to the finite difference scheme defined in `job`.
112- ifixb : Int32Vector | None
109+ ifixb : NDArray[np.int32] | None
113110 Array with the same shape as `beta0`, containing the values designating
114111 which elements of `beta` are to be held fixed. Zero means the parameter
115112 is held fixed, and one means it is adjustable. By default, `ifixb` is
116113 set to one for all elements of `beta`.
117- ifixx : Int32Array | None
114+ ifixx : NDArray[np.int32] | None
118115 Array with the same shape as `x`, containing the values designating
119116 which elements of `x` are to be held fixed. Alternatively, it can be a
120117 rank-1 array of shape `(m,)` or `(n,)`, in which case it will be broadcast
121118 along the other axis. Zero means the element is held fixed and one means
122119 it is free. By default, in orthogonal distance regression mode, `ifixx`
123120 is set to one for all elements of `x`. In ordinary least squares mode,
124121 the `x` values are intrinsically fixed.
125- delta0 : Float64Array | None
122+ delta0 : NDArray[np.float64] | None
126123 Array with the same shape as `x`, containing the initial guesses of the
127124 errors in the explanatory variable. To activate this option, `job` must
128125 be set accordingly. By default, `delta0` is set to zero for all elements
129126 of `x`.
130- lower : Float64Vector | None
127+ lower : NDArray[np.float64] | None
131128 Array with the same shape as `beta0`, containing the lower bounds of the
132129 model parameters. By default, `lower` is set to negative infinity for
133130 all elements of `beta`.
134- upper : Float64Vector | None
131+ upper : NDArray[np.float64] | None
135132 Array with the same shape as `beta0`, containing the upper bounds of the
136133 model parameters. By default, `upper` is set to positive infinity for
137134 all elements of `beta`.
@@ -183,29 +180,29 @@ def odr(f: Callable[[Float64Vector, Float64Array], Float64Array],
183180 maxit : int | None
184181 Maximum number of allowed iterations. The default value is 50 for a
185182 first run and 10 for a restart (see `job`).
186- stpb : Float64Vector | None
183+ stpb : NDArray[np.float64] | None
187184 Array with the same shape as `beta0` containing the _relative_ step
188185 sizes used to compute the finite difference derivatives with respect
189186 to the model parameters. By default, `stpb` is set internally based on
190187 the value of `ndigit` and the type of finite differences used. For
191188 additional details, refer to pages 31 and 78 of the ODRPACK95 guide.
192- stpd : Float64Array | None
189+ stpd : NDArray[np.float64] | None
193190 Array with the same shape as `x`, containing the _relative_ step sizes
194191 used to compute the finite difference derivatives with respect to the
195192 errors in the explanatory variable. Alternatively, it can be a rank-1
196193 array of shape `(m,)` or `(n,)`, in which case it will be broadcast along
197194 the other axis. By default, `stpd` is set internally based on the value
198195 of `ndigit` and the type of finite differences used. For additional
199196 details, refer to pages 31 and 78 of the ODRPACK95 guide.
200- sclb : Float64Vector | None
197+ sclb : NDArray[np.float64] | None
201198 Array with the same shape as `beta0` containing the scale values of the
202199 model parameters. Scaling is used to improve the numerical stability
203200 of the regression, but does not affect the problem specification. Scaling
204201 should not be confused with the weighting matrices `we` and `wd`. By
205202 default, `sclb` is set internally based on the relative magnitudes of
206203 `beta`. For further details, refer to pages 32 and 84 of the ODRPACK95
207204 guide.
208- scld : Float64Array | None
205+ scld : NDArray[np.float64] | None
209206 Array with the same shape as `x`, containing the scale values of the
210207 errors in the explanatory variable. Alternatively, it can be a rank-1
211208 array of shape `(m,)` or `(n,)`, in which case it will be broadcast along
@@ -214,11 +211,11 @@ def odr(f: Callable[[Float64Vector, Float64Array], Float64Array],
214211 should not be confused with the weighting matrices `we` and `wd`. By
215212 default, `scld` is set internally based on the relative magnitudes of
216213 `x`. For further details, refer to pages 32 and 85 of the ODRPACK95 guide.
217- work : Float64Vector | None
214+ work : NDArray[np.float64] | None
218215 Array containing the real-valued internal state of the odrpack solver.
219216 It is only required for a restart (see `job`), in which case it must be
220217 set to the state of the previous run.
221- iwork : Int32Vector | None
218+ iwork : NDArray[np.int32] | None
222219 Array containing the integer-valued internal state of the odrpack solver.
223220 It is only required for a restart (see `job`), in which case it must be
224221 set to the state of the previous run.
0 commit comments