function normmodes
%
%  Name:   normmodes
%
%  Usage:  normmodes
%
%  Normalizes the identified modes
% 

%  Version SWD980701
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This matlab source code was originally     %
% developed as part of "DIAMOND" at          %
% Los Alamos National Laboratory. It may     %
% be copied, modified, and distributed in    %
% any form, provided:                        %
%  a) This notice accompanies the files and  %
%     appears near the top of all source     %
%     code files.                            %
%  b) No payment or commercial services are  %
%     received in exchange for the code.     %
%                                            %
% Original copyright is reserved by the      %
% Regents of the University of California,   %
% in addition to Scott W. Doebling, Phillip  %
% J. Cornwell, Erik G. Straser, and Charles  %
% R. Farrar.                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global MODES

for i = 1:MODES.nmodes,
   modes_mat(:,i) = MODES.modalvector{i}.';
   mpf_mat(:,i) = MODES.mpf{i}.';
end

switch MODES.imnmeth,
case 'Drive Point',
   [modes_mat_out,mpf_mat_out] = dpnorm(MODES.dppair,modes_mat,mpf_mat);
case 'Unit Mass',
   [modes_mat_out,mpf_mat_out] = unmnorm(modes_mat,mpf_mat);
end

for i = 1:MODES.nmodes,
   MODES.modalvector{i} = modes_mat_out(:,i).';
   MODES.mpf{i} = mpf_mat_out(:,i).';
end

return