Get the approximate vector of the value of another vector within a list

Hello, I would like to know how I can find in a list of vectors a vector that comes close to another pre-selected vector, being the same or not. I appreciate any help.

I found te answer:

def closest(self, vec, list):
        current = list[0]
        for val in list:
            if vec - val < vec - current:
                current = val
        return current

This function returns the aproximate vector on the list.

1 Like