%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ log_post, log_joint, log_lkld ] = compute_post_gu( gu, data )
  
  if nargin < 2
    error( [ mfilename ' needs 2 input arguments.' ] );
  end
  
  if numel( size( data ) ) > 2
    error( [ mfilename ' at most deals with 2-D data.' ] );
  end
  
  log_joint = repmat( -Inf, [ size( data ), 2 ] );
  
  % Joint for the uniform pdf
  
  tmp = log_joint( :,:,1 );
  
  ind = find( ( gu.u_min <= data ) & ( data <= gu.u_max ) );
  tmp( ind ) = log( gu.u_prior ) + log( gu.u_pdf );
  
  log_joint( :,:,1 ) = tmp;
  
  % Joint for the Gaussian pdf
  
  log_joint( :,:,2 ) = log( gu.g_prior ) + log_normpdf( data, gu.g_mu, gu.g_sigma );
  
  % Posteriors
  
  log_lkld = my_logsum_fast( log_joint( :,:,1 ), log_joint( :,:,2 ) );
  
  log_post = log_joint - repmat( log_lkld, [ 1 1 2 ] );
  