%%**********************************************************************
%% blktrace: compute <X1,Z1> + ... <Xp,Zp>
%%              
%% SDPT3: version 3.0 
%% Copyright (c) 1997 by
%% K.C. Toh, M.J. Todd, R.H. Tutuncu
%% Last Modified: 2 Feb 01
%%**********************************************************************

  function trXZ = blktrace(blk,X,Z); 

  if (nargin == 3); options = 1; end;   
  trXZ = 0; 
  for p = 1:size(blk,1)
      pblk = blk(p,:);
      if strcmp(pblk{1},'s')
         trXZ = trXZ + sum(sum(X{p}.*Z{p})); 
      else
         trXZ = trXZ + X{p}'*Z{p}; 
      end
  end
%%**********************************************************************




