% prepare vectors of data for the Ridge-Regression Least Square problem
% solved via LARS
% lambdaRR is the regularization parameter for RR 
% calling LARS wit Y, X will solve Y'*X*pinv(X'*X + lambdaRR I) when the 
% constraint is not active in LARS

function [Y X]=prepare_data_LARS_RR(Y,X,nx,lambdaRR);

 nr = length(nx);
 [N ny]=size(Y);
 
 Y = [Y; zeros(sum(nx),ny)];


Xnew = [X; sqrtm(lambdaRR)];
%  Xnew = zeros(size(Y,1),0);
%  for i = 1:nr,
%      Xnew = [Xnew [X(:,sum(nx(1:i-1))+1:sum(nx(1:i))); zeros(sum(nx(1:i-1)),nx(i)); sqrt(lambdaRR)*eye(nx(i)); zeros(sum(nx(i+1:end)),nx(i))]];
%  end;
%  
     
 X = Xnew;