R: cosmetics + start translation of (selmix.m into) main.R
[valse.git] / R / generateIOdefault.R
CommitLineData
39046da6
BA
1generateIOdefault = function(n, p, m, k)
2{
3 covX = array(0, dim=c(p,p,k))
4 covY = array(0, dim=c(m,m,k))
5 for(r in 1:k)
6 {
7 covX[,,r] = diag(p)
8 covY[,,r] = diag(m)
9 }
10
11 pi = rep(1./k,k)
12
13 beta = array(0, dim=c(p,m,k))
14 for(j in 1:p)
15 {
16 nonZeroCount = ceiling(m * runif(1))
17 beta[j,1:nonZeroCount,] = matrix(runif(nonZeroCount*k), ncol=k)
18 }
19
20 sample_IO = generateIO(covX, covY, pi, beta, n)
21 return (list(X=sample_IO$X,Y=sample_IO$Y))
22}