end
B = max(P{2} + lambda*(P{2} - P{3}),0);% PSF positivity constraint
sumPSF = sum(B(:));
B = B/(sum(B(:)) + (sumPSF==0)*eps);% normalization is a necessary constraint,
% because given only input image, the algorithm cannot even know how much
% power is in the image vs PSF. Therefore, we force PSF to satisfy this
% type of normalization: sum to one.

% 3. Convert the right array (for cell it is first array, for notcell it is
% second array) to the original image class & output the whole
num = 1 + strcmp(classI{1},'notcell');
if ~strcmp(classI{2},'double'),
J{num} = images.internal.changeClass(classI{2},J{num});
end

case 0, % no-cell array is used to do a single set of iterations
classI{1} = 'notcell';

J{1} = varargin{1};% create a cell array in order to do the iterations
P{1} = varargin{2};
case 1,
error(message('images:deconvblind:IandInitpsfMustBeOfSameType'))
case 2,% input cell is used to resume the interrupted iterations or
classI{1} = 'cell';% to interrupt the iteration to resume them later
J = varargin{1};
P = varargin{2};
if length(J)~=length(P),
error(message('images:deconvblind:IandInitpsfMustBeOfSameSize'))
end
end;

% check the Image, which is the first array of the J-cell
[sizeI, sizePSF] = padlength(size(J{1}), size(P{1}));
classI{2} = class(J{1});