Hmm, how sure are you on this? I tried it and failed. The product is a function of i and dv. I think you need both of those loops. I don’t think you reuse anything.
Did you re-try the centered parameterization of this after working out the issues in the last thread? It isn’t a given that non-centered works better.
Here’s a discussion of someone doing the map_rect stuff that probably has something you could use: Linear, parallell regression
Try to make the return value of your map_rect function just be a single number (like something to be incremented in target()). If the function returns a lot of things, that’ll mess up the map_rect efficiency.