Hello, I am solving an inverse problem through simulated annealing, but the loop I use to match the zeros of my data with zeros in my model (so that the inversion is only solved for non-zero elements of data) is making my code very inefficient.
D is the data matrix of dimensions 26x12x160 with many zeros
S is my model, it has the same dimensions, I want it to have zeros where D has zeros
I am using the following loop for this
Is there a more efficient way to do this? Maybe a way to kill 1 loop? I am very inexperienced with efficient coding...
Thanks in advance