CyRK.array

Submodules

CyRK.array.interp module

CyRK.array.interp.binary_search_with_guess(key, array, length, guess)
CyRK.array.interp.interp(desired_x, x_domain, dependent_values, provided_j=-2)

Interpolation function for floats.

Provided a domain, x_domain and a dependent array dependent_values search domain for value closest to desired_x and return the value of dependent_values at that location if it is defined. Otherwise, use local slopes of x_domain and dependent_values to interpolate a value of dependent_values at desired_x.

Based on numpy’s interp function.

Parameters:
  • desired_x (float) – Location where dependent_variables is desired.

  • x_domain (np.ndarray[float]) – Domain to search for the correct location.

  • dependent_values (np.ndarray[float]) – Dependent values that are to be returned after search and interpolation.

  • provided_j (int) – Give a j index from a previous interpolation to improve performance.

Returns:

result – Desired value of dependent_values.

Return type:

float

CyRK.array.interp.interp_array(desired_x_array, x_domain, dependent_values, desired_dependent_array)
CyRK.array.interp.interp_complex(desired_x, x_domain, dependent_values, provided_j=-2)

Interpolation function for complex numbers.

Provided a domain, desired_x and a dependent array dependent_values search domain for value closest to desired_x and return the value of dependent_values at that location if it is defined. Otherwise, use local slopes of desired_x and dependent_values to interpolate a value of dependent_values at desired_x.

Based on numpy’s interp function.

Parameters:
  • desired_x (float) – Location where dependent_variables is desired.

  • x_domain (np.ndarray[float]) – Domain to search for the correct location.

  • dependent_values (np.ndarray[complex]) – Dependent values that are to be returned after search and interpolation.

  • provided_j (int) – Give a j index from a previous interpolation to improve performance.

Returns:

result – Desired value of dependent_values.

Return type:

complex

CyRK.array.interp.interp_complex_array(desired_x_array, x_domain, dependent_values, desired_dependent_array)
CyRK.array.interp.interp_complexj(desired_x, x_domain, dependent_values, provided_j=-2)

Interpolation function for complex numbers.

Provided a domain, desired_x and a dependent array dependent_values search domain for value closest to desired_x and return the value of dependent_values at that location if it is defined. Otherwise, use local slopes of desired_x and dependent_values to interpolate a value of dependent_values at desired_x.

Based on numpy’s interp function.

Parameters:
  • desired_x (float) – Location where dependent_variables is desired.

  • x_domain (np.ndarray[float]) – Domain to search for the correct location.

  • dependent_values (np.ndarray[complex]) – Dependent values that are to be returned after search and interpolation.

  • provided_j (int) – Give a j index from a previous interpolation to improve performance.

Returns:

  • result (complex) – Desired value of dependent_values.

  • j_out (int) – The index that was found during c_binary_search_with_guess which can be used by other interpolation functions to improve performance.

CyRK.array.interp.interpj(desired_x, x_domain, dependent_values, provided_j=-2)

Interpolation function for floats. This function will return the index that it found during interpolation.

Provided a domain, x_domain and a dependent array dependent_values search domain for value closest to desired_x and return the value of dependent_values at that location if it is defined. Otherwise, use local slopes of x_domain and dependent_values to interpolate a value of dependent_values at desired_x.

Based on numpy’s interp function.

Parameters:
  • desired_x (float) – Location where dependent_variables is desired.

  • x_domain (np.ndarray[float]) – Domain to search for the correct location.

  • dependent_values (np.ndarray[float]) – Dependent values that are to be returned after search and interpolation.

  • provided_j (int) – Give a j index from a previous interpolation to improve performance.

Returns:

  • result (float) – Desired value of dependent_values.

  • j_out (int) – The index that was found during c_binary_search_with_guess which can be used by other interpolation functions to improve performance.