the numpy multiline comment style is
/*
 * comment
 */
I think it would be easier if the text would describe the code lines, as the variables are not named very well (maybe rename to needle, haystack?)
e.g.
If the needle (ap2) is larger than the haystack (op1) we copy the haystack to a continuous array for improved cache utilization.