Solved by ptrblck in post #2 
              
              
                You could trade memory for compute by using loops and perform the comparison without the broadcasting for the sub-elements (including the sum). I don’t know, of there would be another better way “between” these approaches.