- r1 = runProcedure1(sx)
- Phi2 = Phi
- Rho2 = Rho
- Pi2 = Pi
- p = ncol(X)
- m = ncol(Y)
- if size(Phi2) == 0 #TODO: continue translation MATLAB --> R
- Phi(:,:,1:k,:) = r1$phi;
- Rho(:,:,1:k,:) = r1$rho;
- Pi(1:k,:) = r1$pi;
- else
- Phi = zeros(p,m,sx.kmax,size(Phi2,4)+size(r1$phi,4));
- Phi(:,:,1:size(Phi2,3),1:size(Phi2,4)) = Phi2;
- Phi(:,:,1:k,size(Phi2,4)+1:end) = r1$phi;
- Rho = zeros(m,m,sx.kmax,size(Rho2,4)+size(r1$rho,4));
- Rho(:,:,1:size(Rho2,3),1:size(Rho2,4)) = Rho2;
- Rho(:,:,1:k,size(Rho2,4)+1:end) = r1$rho;
- Pi = zeros(sx.kmax,size(Pi2,2)+size(r1$pi,2));
- Pi(1:size(Pi2,1),1:size(Pi2,2)) = Pi2;
- Pi(1:k,size(Pi2,2)+1:end) = r1$pi;
- end
- else
- [phi] = runProcedure2(sx);
- phi
- Phi2 = sx.Phi;
- if size(Phi2,1) == 0
- sx.Phi(:,:,1:k,:) = phi;
- else
- size(Phi2)
- sx.Phi = zeros(p,m,sx.kmax,size(Phi2,4)+size(phi,4));
- size(sx.Phi)
- sx.Phi(:,:,1:size(Phi2,3),1:size(Phi2,4)) = Phi2;
- sx.Phi(:,:,1:k,size(Phi2,4)+1:end) = phi;
- end
-
- end
-
-
- end
- end
-
+ Phi[,,1:k] <<- r1$phi
+ Rho[,,1:k] <<- r1$rho
+ Pi[1:k,] <<- r1$pi
+ } else
+ {
+ Phi <<- array(0., dim=c(p,m,kmax,dim(Phi2)[4]+dim(r1$phi)[4]))
+ Phi[,,1:(dim(Phi2)[3]),1:(dim(Phi2)[4])] <<- Phi2
+ Phi[,,1:k,dim(Phi2)[4]+1] <<- r1$phi
+ Rho <<- array(0., dim=c(m,m,kmax,dim(Rho2)[4]+dim(r1$rho)[4]))
+ Rho[,,1:(dim(Rho2)[3]),1:(dim(Rho2)[4])] <<- Rho2
+ Rho[,,1:k,dim(Rho2)[4]+1] <<- r1$rho
+ Pi <<- array(0., dim=c(kmax,dim(Pi2)[2]+dim(r1$pi)[2]))
+ Pi[1:nrow(Pi2),1:ncol(Pi2)] <<- Pi2
+ Pi[1:k,ncol(Pi2)+1] <<- r1$pi
+ }
+ } else
+ {
+ phi = runProcedure2()$phi
+ Phi2 = Phi
+ if (dim(Phi2)[1] == 0)
+ {
+ Phi[,,1:k,] <<- phi
+ } else
+ {
+ Phi <<- array(0., dim=c(p,m,kmax,dim(Phi2)[4]+dim(phi)[4]))
+ Phi[,,1:(dim(Phi2)[3]),1:(dim(Phi2)[4])] <<- Phi2
+ Phi[,,1:k,-(1:(dim(Phi2)[4]))] <<- phi
+ }
+ }
+ }
+ }
+