I have used a parfor loop, but the CPU usage is around 50%. The configuration of the computer is shown in the picture. Are there only 4 cores that I can use? Is there a command to open all the cores? Does it matter how I write parfor?
The simplified codes are as follows:
n = 5;
d = 2^n;
r0 = [2 3];
m = d^2;
delta0 = 0:0.05:0.5;
ave = 50;
tic;
for j = 1:length(r0)
  for k1 = 1:length(delta0)
    delta = delta0(k1);
    r = r0(j);
    parfor i = 1:ave
    % Getdataz and Solve_CC_rhoE_zGau are function file
    [Pauli,y,rhoT,noiseT] = Getdataz(d,n,r,m,s,delta);
    [rhoE,noiseE] = Solve_CC_rhoE_zGau(n,r,m,s,Pauli,y,noiseT,delta);
    rhoE = rhoE/trace(rhoE);
   FdRho(i) = fullfidelity(rhoT,rhoE);
   end
   out.delta(k1,1) = delta;
   out.FdRho(k1,:) = FdRho;
   end  
 end
toc;

 
     
    