Description Usage Arguments Value Examples
This function returns a zero-one matrix with given dimension and non-zero probability
1 | gzomat(m, n, p)
|
m |
m is the row dimension of matrix. |
n |
n is the column dimension of matrix. |
p |
p is the non-zero probability of matrix. |
M is a zero-one matrix with given dimension and non-zero probability.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (m, n, p)
{
M <- matrix(0, m, n)
index <- c(1:(m * n))
index <- sample(index, round(p * m * n), replace = FALSE)
M[index] <- 1
return(M)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.