cupyx.scipy.signal.correlate#

cupyx.scipy.signal.correlate(in1, in2, mode='full', method='auto')[source]#

Cross-correlate two N-dimensional arrays.

Cross-correlate in1 and in2, with the output size determined by the mode argument.

Parameters:
  • in1 (cupy.ndarray) – First input.

  • in2 (cupy.ndarray) – Second input. Should have the same number of dimensions as in1.

  • mode (str) –

    Indicates the size of the output:

    • 'full': output is the full discrete linear convolution (default)

    • 'valid': output consists only of those elements that do not rely on the zero-padding. Either in1 or in2 must be at least as large as the other in every dimension.

    • 'same': - output is the same size as in1, centered with respect to the 'full' output

  • method (str) –

    Indicates which method to use for the computations:

    • 'direct': The convolution is determined directly from sums, the definition of convolution

    • 'fft': The Fourier Transform is used to perform the convolution by calling fftconvolve.

    • 'auto': Automatically choose direct of FFT based on an estimate of which is faster for the arguments (default).

Returns:

the result of correlation.

Return type:

cupy.ndarray

See also

cupyx.scipy.ndimage.correlation()

See also

scipy.signal.correlation()

Note

By default, convolve and correlate use method='auto', which calls choose_conv_method to choose the fastest method using pre-computed values. CuPy may not choose the same method to compute the convolution as SciPy does given the same inputs.