function [ prc,  rcl,  F ] = prc_rcl( tp, fp, tn, fn )

% function [ prc,  rcl,  F ] = prc_rcl( tp, fp, tn, fn )
  
  if nargin < 4
    error( 'prc_rcl needs 4 input arguments !' );
  end
  
  if nargout < 1
    error( 'prc_rcl needs at least 1 output argument !' );
  end

  v = [ tp fp tn fn ];
  
  if any( v < 0 )
    error( [ mfilename ' will not get fooled so easily! All input arguments must be >=0.' ] );
  end
  
  if any( isnan( v ) )
    error( [ mfilename ' will not get fooled so easily! All input arguments must be non-NaN.' ] );
  end
  
  % To remember: PRC evaluated over "obtained 1"
  tmp = tp + fp;
  if tmp == 0
    % This is possible (not a single positive in the result)
    prc = NaN;
  else
    % Usual case (at least one positive in the result)
    prc = tp ./ tmp;
  end
  
  % To remember: RCL evaluated over "desired 1"
  tmp = tp + fn;
  if tmp == 0
    % This is possible (not a single positive in the ground-truth)
    rcl = NaN;
  else
    % Usual case ( at least one positive in the ground-truth )
    rcl = tp ./ tmp;
  end
  
  F = NaN;
  if prc + rcl > 0
    F = 2 * prc .* rcl ./ ( prc + rcl );
  end
  