I’m trying to accomplish something that I don’t even have the correct wording for.
(If you have a better Idea, I’d be happy to rename this thread so it could maybe help someone in the future)
I have two 1d matrices, binary, either 0 or 1 (yeah, that’s pretty much what binary means :D)
The way I framed to problem I’m trying to solve, (of which details would be of little interest here) I want the resulting matrix to be the resulting state of the two input matrices would act as “triggers”. Which I feel is totally unclear, so I’ll illustrate with an example:
a = [1, 0, 0, 0, 1, 0] # Obviously not Python lists, I just want to illustrate what I'd functionnaly want b = [0, 0, 1, 0, 0, 0] # What I want: result = [1, 1, 0, 0, 1, 1] # So where a==1 and b ==0, result should be 1 # where a==0 and b ==1, result should be 0 # where a==0 and b==0, result should be the last state triggered # [1, 0] -> 1 # [0, 1] -> 0 # [0, 0] -> the last value # It's assumed either a or b while not be 0 at first position # It's also assumed a==1 & b==1 will never occur
To try and be even clearer, here’s what it would look like with Python lists and iterations:
(Which, again, is obviously a mere illustration of what I want, if you landed here from google, that’s a scrappy and only illustrative implementation of what I functionality want)
a = [1, 0, 0, 0, 1, 0] b = [0, 0, 1, 0, 0, 0] results =  for a_value, b_value in zip(a, b): if a_value==1 and b_value==0: result.append(1) if a_value==0 and b_value==1: result.append(0) if a_value==0 and b_value==0: result.append(result[-1])
I hope it’s clear.
Thanks a lot in advance,