function f_beta = compute_f_beta( prc, rcl, beta )

% function f_beta = compute_f_beta( prc, rcl, beta ) 
%
% f_beta = ( ( beta .^ 2 + 1 ) .* prc .* rcl ) ./ ( beta .^ 2 .* prc + rcl )
%
% prc, rcl, beta are "repmat-ed" as needed.
%
% Guillaume Lathoud
% 2005
  
  if nargin < 3
    error( [ mfilename ' needs 3 input arguments.' ] );
  end
  
  % Common size
  
  numel_list = [ numel( prc )  numel( rcl )  numel( beta ) ];
  
  n = numel( unique( numel_list ) );
  
  if n > 2
    error( [ mfilename ': inconsistent sizes for the 3 input arguments. They must be either [ 1 1 ] or <your-size>. You cannot have multiple values for <your-size>.' ] );
  end
  
  if n > 1
    
    % We need to replicate some of the parameters
    
    [ numel_max, ind ] = max( numel_list );
    
    switch ind
     case 1
      size_max = size( prc );
     case 2
      size_max = size( rcl );
     case 3
      size_max = size( beta );
     otherwise
      error( [ mfilename ': this cannot happen.' ] );
    end
    
    if numel_list( 1 ) < numel_max
      prc = repmat( prc, size_max );
    end
    
    if numel_list( 2 ) < numel_max
      rcl = repmat( rcl, size_max );
    end
    
    if numel_list( 3 ) < numel_max
      beta = repmat( beta, size_max );
    end
    
  end
  
  %%%% Actual computation of F-beta
  beta2  = beta .^ 2;
  f_beta = ( ( beta2 + 1 ) .* prc .* rcl ) ./ ( beta2 .* prc + rcl ); 
  
  % Special case
  ind = find( beta2 == +Inf );
  f_beta( ind ) = rcl( ind );
  