def reduce_sorted_to_intersect(ar1, ar2):
<EOL>ar1 = np.asarray(ar1).ravel()<EOL>ar2 = np.asarray(ar2).ravel()<EOL>ar1_biggest_value = ar1[-<NUM_LIT:1>]<EOL>ar1_smallest_value = ar1[<NUM_LIT:0>]<EOL>ar2_biggest_value = ar2[-<NUM_LIT:1>]<EOL>ar2_smallest_value = ar2[<NUM_LIT:0>]<EOL>if ar1_biggest_value < ar2_smallest_value or ar1_smallest_value > ar2_biggest_value:  <EOL><INDENT>return ar1[<NUM_LIT:0>:<NUM_LIT:0>], ar2[<NUM_LIT:0>:<NUM_LIT:0>]<EOL><DEDENT>min_index_ar1 = np.argmin(ar1 < ar2_smallest_value)<EOL>max_index_ar1 = np.argmax(ar1 > ar2_biggest_value)<EOL>min_index_ar2 = np.argmin(ar2 < ar1_smallest_value)<EOL>max_index_ar2 = np.argmax(ar2 > ar1_biggest_value)<EOL>if min_index_ar1 < <NUM_LIT:0>:<EOL><INDENT>min_index_ar1 = <NUM_LIT:0><EOL><DEDENT>if min_index_ar2 < <NUM_LIT:0>:<EOL><INDENT>min_index_ar2 = <NUM_LIT:0><EOL><DEDENT>if max_index_ar1 == <NUM_LIT:0> or max_index_ar1 > ar1.shape[<NUM_LIT:0>]:<EOL><INDENT>max_index_ar1 = ar1.shape[<NUM_LIT:0>]<EOL><DEDENT>if max_index_ar2 == <NUM_LIT:0> or max_index_ar2 > ar2.shape[<NUM_LIT:0>]:<EOL><INDENT>max_index_ar2 = ar2.shape[<NUM_LIT:0>]<EOL><DEDENT>return ar1[min_index_ar1:max_index_ar1], ar2[min_index_ar2:max_index_ar2]<EOL>
Takes two sorted arrays and return the intersection ar1 in ar2, ar2 in ar1.

Parameters
----------
ar1 : (M,) array_like
    Input array.
ar2 : array_like
     Input array.

Returns
-------
ar1, ar1 : ndarray, ndarray
    The intersection values.