I am trying to apply a method that takes in two vectors and returns a resulting vector.
Below is an example input and expected result:
a = [ 1, 0, -1, 0, 0, 1]
b = [ 0, 0, -1, 0, 1, -1]
result = my_func(a, b)
# [ 1, 0, -1, 0, 1, 0]
My intial intuition is that a bitwise logic would be able to meet the above specifications. bitwise or seems the closest:
np.bitwise_or(a,b)
# array([ 1, 0, -1, 0, 1, -1])
np.bitwise_and(a,b)
# array([ 0, 0, -1, 0, 0, 1])
np.bitwise_xor(a,b)
# array([ 1, 0, 0, 0, 1, -2])
If a logical pairing is not possible, would the most efficient method of meeting the specification be applying a lambda to each index?