new ScalarField(parameters)
- Description:
Implements a real-value function on a symboling space.
ScalarField parameters
General parameter
type: ...
The type element used to calculate the distance, mandatory, default is "value".epsilon: ...
The threshold between to indistinguishable numerical value, default is1e-12
.points
: Optionally defines trajectory weighted points calling the add() method.verbose: ...
If true print the interpolation, extrapolation and barycenter intermediate values. Default is false.
Parameters:
Name | Type | Description |
---|---|---|
parameters |
JSON | String | The scalar-field parameters. |
Methods
getParameters() → {JSON}
- Description:
Returns the trajectory parameters.
Returns:
The trajectory parameters.
- Type
- JSON
setParameters(parameters) → {ScalarField}
- Description:
Modifies some ScalarField parameters.
- All parameters but the
type
can be modified. - The ScalarField points are preserved when changing the parameters, thus using the
points
field simply adds the points.
- All parameters but the
Parameters:
Name | Type | Description |
---|---|---|
parameters |
JSON | The Trajectory parameters. |
Returns:
This value allowing to chain methods.
- Type
- ScalarField
set(input, outputopt) → {ScalarField}
- Description:
Adds/Replaces a punctual value for this scalar-field.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
input |
Value | The input data structure |
||
output |
double |
<optional> |
NAN
|
The corresponding output value.
|
Returns:
This value allowing to chain add methods.
- Type
- ScalarField
erase(input) → {ScalarField}
- Description:
Deletes a punctual value for this scalar-field.
Parameters:
Name | Type | Description |
---|---|---|
input |
Value | The input data structure |
Returns:
This value allowing to chain add methods.
- Type
- ScalarField
clear(input) → {ScalarField}
- Description:
Deletes all values of this scalar-field.
Parameters:
Name | Type | Description |
---|---|---|
input |
Value | The input data structure |
Returns:
This value allowing to chain add methods.
- Type
- ScalarField
add(field) → {ScalarField}
- Description:
Adds all values of a scalar-field to this one.
Parameters:
Name | Type | Description |
---|---|---|
field |
ScalarField | JSON | String | The scalar-field to copy or the scalar-field value or values.
|
Returns:
This value allowing to chain add methods.
- Type
- ScalarField
load(filename) → {ScalarField}
- Description:
Loads all values of a scalar-field strored in a wJSON or JSON file.
- It is short-cut for
add(wjson::string2json(aidesys::load(filename)))
.
- It is short-cut for
Parameters:
Name | Type | Description |
---|---|---|
filename |
String | The file name. |
Returns:
This value allowing to chain add methods.
- Type
- ScalarField
save(filename, prettyopt, strictopt)
- Description:
Saves all values of a scalar-field strored in a wjson file.
- It is short-cut for
aidesys::save(filename, getValues().asString(pretty, strict))
.
- It is short-cut for
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filename |
String | The file name. |
||
pretty |
bool |
<optional> |
false
|
If true properly format in 2D, else returns a minimal raw format. |
strict |
bool |
<optional> |
false
|
If true strict JSON syntax, else produces a weak JSON syntax. |
getValues() → {JSON}
- Description:
Returns the scalar-field defined values.
Returns:
The current scalar-field values:
[
{ input: ... output: ... }
../..
]
- Type
- JSON
has(input, NaNopt) → {bool}
- Description:
Returns true if the point is stored in the field table.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
input |
JSON | The data point to check. |
||
NaN |
bool |
<optional> |
false
|
If true includes also points with not-a-number output value. |
Returns:
True if the point is explicitly stored.
- Type
- bool
get()
- Description:
Defines an iterator over the scalarfield values, used in a construct of the form:
for(auto it = scalarfield.get().cbegin(); it != scalarfield.get().cend(); it++) { JSON input& = it->first; double output = it->second; ../.. }
- The
scalarfield.get().size()
construct returns the number of predefined values in this field. - The
scalarfield.edit()
construct returns a modifiablestd::unordered_map < wjson::Value, double >
allowing to edit the predefined values.
- The
Returns:
A const std::unordered_map < wjson::Value, double >&
reference for iteration.
getValue(input, K_maxopt, d_maxopt, save_interpolationopt) → {double}
- Description:
Returns a punctual interpolated value for this scalar-field.
- Parameters can also be specified via the ScalarField "K_max", "d_max", "save_interpolation" parameters.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
input |
Value | The input data structure |
||
K_max |
uint |
<optional> |
-1
|
The maximal cardinal of the interpolation neighborhood:
|
d_max |
double |
<optional> |
DBL_MAX
|
The maximal neighborhood distance, unbounded if equals to NAN. |
save_interpolation |
bool |
<optional> |
false
|
If true save the interpolatd value for further use. |
Returns:
The exact or interpolated value, 0 by default.
- Type
- double
getExtrapolations(input, reference, d_maxopt, nu_maxopt, bounds_countopt) → {Value}
- Description:
Returns extrapolated values for this scalar-field.
- Given type bounds to input related geodesics, the points below
d_max
, on the bound geodesics are computed, as soon as their distance to the reference is higher that for the input. - Parameters can also be specified via the ScalarField "d_max", "nu_max", "bound_counts" parameters.
- Given type bounds to input related geodesics, the points below
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
input |
Value | The input data structure. |
||
reference |
Value | The reference data structure. |
||
d_max |
double |
<optional> |
DBL_MAX
|
The maximal neighborhood distance, unbounded if equals to DBL_MAX or NAN. |
nu_max |
double |
<optional> |
DBL_MAX
|
The maximal deviation |
bounds_count |
int |
<optional> |
0
|
The type bounds count to be taken into account. By default all bounds are considered. |
Returns:
A list of extrapolated data structures value approximating the prolongation of the input with respect to the reference.
- Type
- Value
getBarycenter() → {value}
- Description:
Returns the weighted centroid value of the scalar-field.
- Iteratively
- detect the closest values and consider the path between them
- choosing in their path the value which distance balance corresponds as much as possible to the two values relative weight.
- This is illustrated on this tiny demo page.
- Iteratively
Returns:
A data structure value which distance to the other values is weighted by the scalar-field values.
- Type
- value
getDiameter() → {double}
- Description:
Returns the maximal distance between all predefined values.
Returns:
The computed diameter.
- Type
- double
getDistance(lhs, rhs) → {double}
- Description:
Returns the distance between two data value, given the ScalarField type.
- Values are cached avoiding to be recalculated twice.
Parameters:
Name | Type | Description |
---|---|---|
lhs |
Value | The left hand data structure. |
rhs |
Value | The left hand data structure. |
Returns:
The distance value.
- Type
- double