Search
Document Center

# :linear_decay

Last Updated:Sep 09, 2021

## Feature functions

You can use feature functions in sort expressions. Most feature functions can be used only in fine sort expressions. You can combine various syntax and statements to conduct complex sorts.

The fields that you reference in parameters of feature functions must be configured as index or attribute fields based on the description of each function.

## linear_decay: uses a linear function to calculate the decay degree based on the distance between values and a specified start point

1.Syntax:

linear_decay(origin, value, scale, decay, offset)

2.Parameters:

• origin: the start point of the linear_decay function. The value of this parameter must be a double-precision floating-point number.

• value: the user-defined field or the expression for which you want to calculate the decay degree. The value of this parameter must be a double-precision floating-point number.

• scale: the decay degree. The value of this parameter must be a double-precision floating-point number.

• decay: optional. The decay degree that is obtained when the distance equals the value of the scale parameter. The value of this parameter must be a double-precision floating-point number. Default value: 0.000001.

• offset: optional. The linear function starts to calculate the decay degree only when the distance is greater than the value of the offset parameter. The value of this parameter must be a double-precision floating-point number. Default value: 0.

3.Return value:

The return value is of the DOUBLE type. Valid values: [0,1].

4.Scenario:

The usage of this function is the same as that of the gauss_decay function, except that the decay algorithms of the two functions are different.

5.Usage notes:

• The fields that you reference in the parameters of this function must be configured as attribute fields.

• If the value of the scale parameter is less than or equal to 0, the linear_decay function returns 0 by default.

• If the value of the decay parameter is greater than or equal to 1, the linear_decay function returns 1 by default.

• If the value of the decay parameter is less than or equal to 0, the decay parameter is set to 0.000001 by default.

• If the value of the offset parameter is less than 0, the offset parameter is set to 0 by default.