Operation
Operation
¶
Methods for numeric operations, string manipulation, and other functions.
fl.Op
is a shortcut to this class.
Attributes¶
Functions¶
arity_of
staticmethod
¶
as_identifier
staticmethod
¶
bound
staticmethod
¶
Return \(x\) clipped between [minimum, maximum]
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Scalar
|
value to be clipped |
required |
minimum
|
float
|
minimum value of the range |
required |
maximum
|
float
|
maximum value of the range |
required |
Returns:
Type | Description |
---|---|
Scalar
|
\[\begin{cases} \min & \mbox{if $x < \min$} \cr \max & \mbox{if $x > \max$} \cr x & \mbox{otherwise} \end{cases}\]
|
class_name
staticmethod
¶
describe
staticmethod
¶
Describe the instance based on its variables and class hierarchy.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instance
|
object
|
instance to describe |
required |
variables
|
bool
|
include variables in the description |
True
|
class_hierarchy
|
bool
|
include class hierarchy in the description. |
False
|
Returns:
Type | Description |
---|---|
str
|
description of the instance |
eq
staticmethod
¶
ge
staticmethod
¶
glob_examples
staticmethod
¶
glob_examples(
return_type: Literal["module"], module: ModuleType | None = None, recursive: bool = True
) -> Iterable[ModuleType]
glob_examples(
return_type: Literal["engine"], module: ModuleType | None = None, recursive: bool = True
) -> Iterable[Engine]
glob_examples(
return_type: Literal["dataset"] | Literal["fld"], module: ModuleType | None = None, recursive: bool = True
) -> Iterable[ScalarArray]
glob_examples(
return_type: Literal["language"] | Literal["fll"], module: ModuleType | None = None, recursive: bool = True
) -> Iterable[str]
glob_examples(
return_type: Literal["files"], module: ModuleType | None = None, recursive: bool = True
) -> Iterable[Path]
glob_examples(
return_type: (
Literal["module"]
| Literal["engine"]
| Literal["dataset"]
| Literal["fld"]
| Literal["language"]
| Literal["fll"]
| Literal["files"]
) = "engine",
module: ModuleType | None = None,
recursive: bool = True,
) -> Iterable[ModuleType | Engine | ScalarArray | str | Path]
Glob the examples (alphabetically and in ascending order) returning the specified type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
return_type
|
Literal['module'] | Literal['engine'] | Literal['dataset'] | Literal['fld'] | Literal['language'] | Literal['fll'] | Literal['files']
|
type of objects to return |
'engine'
|
module
|
ModuleType | None
|
package (eg, |
None
|
recursive
|
bool
|
recursively glob into subdirectories |
True
|
Yields:
Type | Description |
---|---|
Iterable[ModuleType | Engine | ScalarArray | str | Path]
|
Iterable of the specified type. |
gt
staticmethod
¶
increment
staticmethod
¶
increment(x: list[int], minimum: list[int], maximum: list[int], position: int | None = None) -> bool
Increment the list by the unit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
list[int]
|
list to increment |
required |
minimum
|
list[int]
|
list of minimum values for each element in the list |
required |
maximum
|
list[int]
|
list of maximum values for each element in the list |
required |
position
|
int | None
|
position in the list to increment |
None
|
Returns:
Type | Description |
---|---|
bool
|
whether the list was incremented. |
is_close
staticmethod
¶
le
staticmethod
¶
lt
staticmethod
¶
midpoints
staticmethod
¶
midpoints(start: float, end: float, resolution: int = 1000) -> ScalarArray
Return the list of values in the range at the given resolution using the midpoint rule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
float
|
start of range |
required |
end
|
float
|
end of range |
required |
resolution
|
int
|
number of divisions to discretize the range |
1000
|
Returns:
Type | Description |
---|---|
ScalarArray
|
list of values in the range at the given resolution using the midpoint rule |
neq
staticmethod
¶
pascal_case
staticmethod
¶
scale
staticmethod
¶
Linearly interpolates \(x\) from the source range [from_minimum, from_maximum]
to its new value in the target range [to_minimum, to_maximum]
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Scalar
|
value to interpolate |
required |
x_min
|
float
|
minimum value of the source range |
required |
x_max
|
float
|
maximum value of the source range |
required |
y_min
|
float
|
minimum value of the target range |
required |
y_max
|
float
|
maximum value of the target range |
required |
Returns:
Type | Description |
---|---|
Scalar
|
\(x\) linearly interpolated to the target range as: \(y = \dfrac{y_\max - y_\min}{x_\max-x_\min} (x-x_\min) + y_\min\) |