## 2 Materials and Methods
### Data Preprocessing Methods
#### Main Steps of the Algorithm  
Input data: The algorithm takes as input a one-dimensional array vector and a new desired length new_size (integer).  
Size comparison: The algorithm compares the current length of the array old_size with the new length new_size.  
Case where the size does not change: If new_size is equal to old_size, then the array size does not need to be changed. In this case, the algorithm simply returns the original array vector unchanged.  
Length increase case (new_size > old_size): When the length of the array needs to be increased, the algorithm uses interpolation to create new values between existing points:  
1. Create interpolation indexes: An array of indices is created containing new_size evenly spaced values ranging from 0 to old_size - 1. These indices represent the positions in the original array for which values must be interpolated to produce an array of the new length.
2. Interpolation: The original array vector is interpolated at the points specified by the array indices. The interpolation method is not explicitly specified in the pseudocode, but it is implied that some one-dimensional interpolation method (e.g., linear, spline, or cubic) is used that approximates the signal values between the source points.
3. Output data (after interpolation): The algorithm returns a new array resulting from the interpolation, whose length is equal to new_size.  
Length reduction case (new_size < old_size): When the length of the array needs to be reduced, the algorithm uses value averaging to preserve the overall information while reducing the granularity:  
1. Creating indexes for averaging: Similar to the increment case, an array of indices is created containing new_size evenly spaced values ranging from 0 to old_size - 1. These indices define the boundaries of the intervals in the original array, which will be averaged to obtain the values in the new array of reduced size.
2. Initializing the output array: A new array resized_vector of length new_size filled with zeros is created.
3. Averaging over intervals (FOR loop): For each index \(i\) from 1 to new_size (in pseudocode, the numbering starts at 1, which may be atypical for Python-like languages, usually indexes start at 0): * The start and end indices of the interval in the source array are specified: start_index and end_index, using the values from the indices array. start_index is taken as an integer part of indices[i]. end_index is usually equal to start_index + 1, but may be limited to old_size for the last interval to keep within the bounds of the original array.
* The average value of the elements of the vector subarray on the interval [start_index,end_index) is calculated.
* The calculated average value is assigned to the element resized_vector[i]. (in the pseudocode, the indexing of resized_vector also starts from 1, which should be taken into account in the implementation).
4. Output (after averaging): The algorithm returns an array of resized_vector of length new_size obtained by averaging sections of the original array.  
Output data: Depending on the relationship between old_size and new_size, the algorithm returns either an interpolated array (if the size increases), an averaged array (if the size decreases), or the original array (if the size does not change).  
Remarks  
The resize_vector algorithm provides two different methods of resizing an array depending on whether the size is increasing or decreasing. Using interpolation while increasing the size allows new points to be added while maintaining the overall waveform.  
Averaging while decreasing the size allows one to preserve the overall energy of the signal while reducing the detail. The choice of a specific interpolation method and averaging method can be customized depending on the requirements of the task.