<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>Could you explain this more by adding some small examples?   </div><div><br></div></div></div></div></div></blockquote><div><br></div><div>Since you are considering implementing all-at-once (four nested loops, right?) I'll give you my old code. </div><div><br></div><div>This code is hardwired for two AMG and for a geometric-AMG, where the blocks of the R (and hence P) matrices are scaled identities and I only store the scale. So you ignore those branches. This code also does equivalent real form complex, so more branches to ignore.</div></div></div>