Solved by iffiX in post #21 
              
              
                then you may use a for-loop to divide X_prime into smaller chunks, just as what your old code was doing, just don’t split them too fine, like into row-by-row operations. 
Time for space, or space for time.