1 | initial version |
You can simply iterate over your list of vectors and search which vector gives a zero cross product with your target vector:
def search(L, target):
for i,v in enumerate(L):
if v.cross_product(target) == 0:
return i
raise ValueError('No vector found')
L = [vector([1,0,0]), vector([0,1,0]), vector([0,0,1])]
v= vector([6,0,0])
search(L, v)
0
search(L[1:], v)
ValueError: No vector found