I have problem with the efficiency of the following code:
g=0
for (i in 1:n){
for (j in 1:m){
g=g+(as.numeric(x[i]>y[j])*as.numeric(z[i]<=a)*as.numeric(h[j]>a))
}
}
Thank you for your help.
I have problem with the efficiency of the following code:
g=0
for (i in 1:n){
for (j in 1:m){
g=g+(as.numeric(x[i]>y[j])*as.numeric(z[i]<=a)*as.numeric(h[j]>a))
}
}
Thank you for your help.
t(h > a) %*% sapply(x, ">", y) %*% (z <= a)