PINE LIBRARY

ArrayExtension

تم تحديثه
Library "ArrayExtension"
Functions to extend Arrays.

index_2d_to_1d(dimension_x, dimension_y, index_x, index_y) returns the flatened one dimension index of a two dimension array.
Parameters:
  • dimension_x: int, dimension of X.
  • dimension_y: int, dimension of Y.
  • index_x: int, index of X.
  • index_y: int, index of Y.

Returns: int, index in 1 dimension

index_3d_to_1d(dimension_x, dimension_y, dimension_z, index_x, index_y, index_z) returns the flatened one dimension index of a three dimension array.
Parameters:
  • dimension_x: int, dimension of X.
  • dimension_y: int, dimension of Y.
  • dimension_z: int, dimension of Z.
  • index_x: int, index of X.
  • index_y: int, index of Y.
  • index_z: int, index of Z.

Returns: int, index in 1 dimension

down_sample(sample, new_size) Down samples a array to a specified size.
Parameters:
  • sample: float array, array with source data.
  • new_size: new size of down sampled array.

Returns: float array with down sampled data.

sort_indices_float(sample, order) Sorts array and returns a extra array with sorting indices.
Parameters:
  • sample: float array with values to be sorted.
  • order: string, default='forward', options='forward', 'backward'.

Returns: _indices int array with indices.
_ordered float array with ordered values.

sort_indices_int(sample, order) Sorts array and returns a extra array with sorting indices.
Parameters:
  • sample: int array with values to be sorted.
  • order: string, default='forward', options='forward', 'backward'.

Returns: _indices int array with indices.
_ordered float array with ordered values.

sort_bool_from_indices(indices, sample) Sorts sample array using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: bool array with data sample to be sorted.

Returns: bool array

sort_box_from_indices(indices, sample) Sorts sample array using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: box array with data sample to be sorted.

Returns: box array

sort_color_from_indices(indices, sample) Sorts sample array using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: color array with data sample to be sorted.

Returns: color array

sort_float_from_indices(indices, sample) Sorts sample array using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: float array with data sample to be sorted.

Returns: float array

sort_int_from_indices(indices, sample) Sorts sample array using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: int array with data sample to be sorted.

Returns: int array

sort_label_from_indices(indices, sample) Sorts sample array using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: label array with data sample to be sorted.

Returns: label array

sort_line_from_indices(indices, sample) Sorts sample array using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: line array with data sample to be sorted.

Returns: line array

sort_string_from_indices(indices, sample) Sorts sample array using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: string array with data sample to be sorted.

Returns: string array

sort_table_from_indices(indices, sample) Sorts sample array using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: table array with data sample to be sorted.

Returns: table array

sort_bool_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: bool array with data sample to be sorted.

Returns: void updates sample array.

sort_box_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: box array with data sample to be sorted.

Returns: void updates sample

sort_color_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: color array with data sample to be sorted.

Returns: void updates sample

sort_float_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: float array with data sample to be sorted.

Returns: void updates sample

sort_int_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: int array with data sample to be sorted.

Returns: void updates sample

sort_label_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: label array with data sample to be sorted.

Returns: void updates sample

sort_line_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: line array with data sample to be sorted.

Returns: void updates sample

sort_string_inplace_from_indices(indices, sample) Sorts sample inplace array using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: string array with data sample to be sorted.

Returns: void updates sample

sort_table_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.
Parameters:
  • indices: int array with positional indices.
  • sample: table array with data sample to be sorted.

Returns: void updates sample

to_float(sample) Transform a integer array into a float array
Parameters:
  • sample: int array, sample data to transform.

Returns: float array

to_int(sample, method) Transform a float array into a int array
Parameters:
  • sample: float array, sample data to transform.
  • method: string, default="round", options=["round", "floor", "ceil"], aproximation method.

Returns: int array
ملاحظات الأخبار
v2

Added:
sort_indices()

sort_from_indices()

sort_inplace_from_indices()

Removed:
sort_indices_float(sample, order) Sorts array and returns a extra array with sorting indices.

sort_indices_int(sample, order) Sorts array and returns a extra array with sorting indices.

sort_bool_from_indices(indices, sample) Sorts sample array using a array with indices.

sort_box_from_indices(indices, sample) Sorts sample array using a array with indices.

sort_color_from_indices(indices, sample) Sorts sample array using a array with indices.

sort_float_from_indices(indices, sample) Sorts sample array using a array with indices.

sort_int_from_indices(indices, sample) Sorts sample array using a array with indices.

sort_label_from_indices(indices, sample) Sorts sample array using a array with indices.

sort_line_from_indices(indices, sample) Sorts sample array using a array with indices.

sort_string_from_indices(indices, sample) Sorts sample array using a array with indices.

sort_table_from_indices(indices, sample) Sorts sample array using a array with indices.

sort_bool_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.

sort_box_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.

sort_color_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.

sort_float_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.

sort_int_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.

sort_label_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.

sort_line_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.

sort_string_inplace_from_indices(indices, sample) Sorts sample inplace array using a array with indices.

sort_table_inplace_from_indices(indices, sample) Sorts sample array inplace using a array with indices.
ملاحظات الأخبار
v3 - reworked functions to support multiple overloads (int, float, string, bool)

Updated:
to_float()
to_int()
arraysconversionSORT

مكتبة باين

كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشور تحكمه قوانين الموقع.

إخلاء المسؤولية