sapply and pmvnorm correlation matrix
===

I'm currently tmatrixrying to use the sapply command to calculate some double sums. Currently my code  is as follows:

M1=sapply(c(p,p), function (x,y) w[x]*w[y]*x*pmvnorm(v,c(qnorm(Q[x]), qnorm(Q[y])),c(0,0), matrix (c(1,rho[x,y],rho[x,y],1),2,2))-Q[x]*Q[y].

Everything seems to be working fine except for when I define the correlation matrix. Sapply seems to input the matrix of all elements of rho and not a 2x2 matrix like it needs.

Is there anyway to ensure that sapply evaluates pmvnorm using just the 2x2  for Each x and y?