As Pascal says, dot product in R is %*%. I am able to use this successfully on your sample data:
> z0= NULL
> for (i in 1:100){
+ z0[i]= 1
+ }
> z1= runif(100, min=0, max= 20)
> z2= runif(100, min=0, max=20)
> q0= runif(1, 0, 1)
> q1= runif(1, 0, 1)
> q2= runif(1, 0, 1)
> i= runif(1, 1, 101)
> i= ceiling(i-1)
> q= matrix(c(q0,q1,q2), ncol=3)
> z= matrix(c(z0[i],z1[i],z2[i]), ncol=3)
> t(q)%*%z
[,1] [,2] [,3]
[1,] 0.3597998 3.227388 2.960053
[2,] 0.3544622 3.179510 2.916141
[3,] 0.3550781 3.185035 2.921208
> z%*%t(q)
[,1]
[1,] 4.340265
Without using matrices or any special libraries:
The dot product of two vectors can be calulated by multiplying them element-wise with * then summing the result.
a <- c(1,2,3)
b <- c(4,5,6)
sum(a*b)