function [lambdas, Lsum] = read_lambdas(fname,fDim)
fid = fopen(fname, 'r');
len = 0;
lambdas = zeros([length(fDim) max(max(fDim))]);
  
for i=1:length(fDim),
  [com, count] = fscanf(fid,'%f', fDim(i));
  if count ~= fDim(i),
   str = sprintf('Reading lambda file %s error at filter %d.\n',fname,i);
   disp(str);
   break;
  end;
  lambdas(i,1:fDim(i)) = com';
end;
fclose(fid);
Lsum = sum(sum(abs(lambdas)));
return;
