np.correlate("full") in G'MIC?

How would you do this?

import numpy as np

# Define two 1D arrays
a = np.array([1, 2, 3])
v = np.array([0, 1, 0.5])

# Compute full cross-correlation
result = np.correlate(a, v, mode='full')

print(result)
# Output: [0.5, 2. , 3.5, 3. , 0. ]

I played a little with correlate, but don’t get how it works.

If I recall correctly, there is a step in the guided filter algorithm that correlates values. I experimented until I got the expected values.

One thing to note when comparing the correlates is that numpy’s may not have the same boundary handling as gmic’s, which may be what is throwing you off.

Yes, I noticed that. And I try changing the center. But it always errors out. Values are similar to numpy otherwise.

EDIT:
I got it. I had to specify all of the coordinate.

C:\Users\Miguel\Downloads>gmic (1,2,3) (0,1,.5) correlate.. .,0,0,1,2,0,0
[gmic]./ Start G'MIC interpreter (v.4.0.0).
[gmic]./ Input image at position 0, with values (1,2,3) (1 image 3x1x1x1).
[gmic]./ Input image at position 1, with values (0,1,.5) (1 image 3x1x1x1).
[gmic]./ Correlate image [0] with kernel [1], dirichlet boundary conditions, without normalization, channel mode 'one for one', kernel center (2,0,0).
[gmic]./ Display images [0,1] = '(1,2,3), (0,1,.5)'.
[0] = '(1,2,3)':
  size = (3,1,1,1) [12 b of float32].
  data = (0.5,2,3.5).
  min = 0.5, max = 3.5, mean = 2, std = 1.22474, norm = 4.06202, coords_min = (0,0,0,0), coords_max = (2,0,0,0).
[1] = '(0,1,.5)':
  size = (3,1,1,1) [12 b of float32].
  data = (0,1,0.5).
  min = 0, max = 1, mean = 0.5, std = 0.408248, norm = 1.11803, coords_min = (0,0,0,0), coords_max = (1,0,0,0).
[gmic]./ End G'MIC interpreter.