function [gw_dmr,den_dmr,beta_mat]=dmr_gw_calc(nbeam,nph,D,evals_mat, ...
	eps_dmr,vuuv_mat)
%
%%size(evals_mat),size(eps_dmr),D, keyboard,
%
% COPYRIGHT (c) 2008
% 
% Applied Research Laboratories, The University of Texas at Austin
% (ARL:UT)
% All rights reserved.
% 
% This material may be reproduced by or for the U.S. Government
% only. This notice must appear in all copies of this file and its
% derivatives. Further distribution outside the U.S. Government is
% prohibited without the explicit written authorization from the
% Director of the Environmental Sciences Laboratory, ARL:UT.
% 
% THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
% EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE
% IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
% PURPOSE, OR NONINFRINGEMENT.
% 
% IN NO EVENT WILL ARL:UT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING
% OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN IF ARL:UT HAS
% BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
beta_mat=evals_mat./(evals_mat + repmat(eps_dmr,[D,1]));% (D,nbeam)
den_summand=beta_mat.*vuuv_mat;							% (D,nbeam)
den_dmr=nph - sum(den_summand,1);						% (1,nbeam)
beta_prod=beta_mat.*(2 - beta_mat);
gw_den=nph - sum(beta_prod.*vuuv_mat,1);				% (1,nbeam)
gw_dmr=10*log10( den_dmr.^2 ./ gw_den );			% (1,nbeam)
