I want to do elementwise multiplication of a vector with every rows of a very big binary matrix. length of my vector is equal to number of columns of my matrix. I have implemented using for loop as follow, but it's very slow.
Does anyone knows solution to speed it up?

```
A <- c()
M # Binary matric
W <- matrix(0, nrow=nrow(M), ncol=ncol(M))
W <- data.frame(W)
for (i in 1:nrow(W)) {
    W[i,] <- M[i,] * A
}

```