void GetMappedDiagonal ( const DistMatrix<T,U,V,BLOCK>& A, AbstractDistMatrix<S>& d, function<S(const T&)> func, Int offset ) { EL_DEBUG_CSE EL_DEBUG_ONLY(AssertSameGrids( A, d )) // TODO(poulson): Make this more efficient const Int diagLength = A.DiagonalLength(offset); d.Resize( diagLength, 1 ); Zero( d ); if( d.Participating() && A.RedundantRank() == 0 ) { const Int iStart = Max(-offset,0); const Int jStart = Max( offset,0); for( Int k=0; k<diagLength; ++k ) { if( A.IsLocal(iStart+k,jStart+k) ) { const Int iLoc = A.LocalRow(iStart+k); const Int jLoc = A.LocalCol(jStart+k); d.QueueUpdate(k,0,func(A.GetLocal(iLoc,jLoc))); } } } d.ProcessQueues(); }