function R = log_opt_return_sample(m)
%--------------------------------------
% return oracle
% - outputs n X m matrix of log normal mixture
%--------------------------------------
% asset dimension 
n = 10;

% generate samples from mixture distribution
% ------------------------------------
% means
mu1=[0.4; 0.2; 0.4; 0.7; 0.9; 0.3; 0.9; 0.5; 0.5; 0.1];
mu2=[5.1; 0.9; 0.7; 1.6; 2.2; 4.4; 3.2; 6.2; 4.2; 0.7];

% covariance
A=randn(n); A=A*A'; 
B=randn(n); B=B*B'; 

C1=diag(1./sqrt(diag(A)))*A*diag((1./sqrt(diag(A)))); 
C2=diag(1./sqrt(diag(B)))*B*diag((1./sqrt(diag(B))));

sigmas1=[0.01; 0.03; 0.05; 0.04; 0.05; 0.09; 0.05; 0.01; 0.03; 0.12];
sigmas2=[0.81; 0.31; 0.74; 0.91; 0.67; 0.71; 0.31; 0.42; 0.51; 0.41]; 

sigma1=diag(sigmas1)*C1*diag(sigmas1); s1Half=sqrtm(sigma1);
sigma2=diag(sigmas2)*C2*diag(sigmas2); s2Half=sqrtm(sigma2); 

% bernoulli trials
p=repmat(rand(1,m) <= 0.9,n,1); q = 1-p;

% samples from first distribution 
r1=exp(repmat(mu1,1,m)+s1Half*randn(n,m));
r1=p.*r1;

% samples from second distribution 
r2=exp(repmat(mu2,1,m)+s2Half*randn(n,m));
r2=q.*r2;

% mixture
R=r1+r2;
