Two matrices
library(parallel)
m <- matrix(1:12000000000, nrow=300000)
p <- matrix(21:32, nrow=3)
# Use all pairings of i and j
i_vec <- rep(seq_len(ncol(m)), times = ncol(m))
j_vec <- rep(seq_len(ncol(m)), each = ncol(m))
library(parallel)
m <- matrix(1: