void ShiftDiagonal ( DistSparseMatrix<T>& A, S alphaPre, Int offset, bool existingDiag ) { EL_DEBUG_CSE const Int mLocal = A.LocalHeight(); const Int n = A.Width(); const T alpha = T(alphaPre); if( existingDiag ) { T* valBuf = A.ValueBuffer(); for( Int iLoc=0; iLoc<mLocal; ++iLoc ) { const Int i = A.GlobalRow(iLoc); const Int e = A.Offset( iLoc, i+offset ); valBuf[e] += alpha; } } else { A.Reserve( mLocal ); for( Int iLoc=0; iLoc<mLocal; ++iLoc ) { const Int i = A.GlobalRow(iLoc); if( i+offset >= 0 && i+offset < n ) A.QueueLocalUpdate( iLoc, i+offset, alpha ); } A.ProcessLocalQueues(); } }
void Fill( DistSparseMatrix<T>& A, T alpha ) { EL_DEBUG_CSE const Int m = A.Height(); const Int n = A.Width(); A.Resize( m, n ); Zero( A ); if( alpha != T(0) ) { const Int localHeight = A.LocalHeight(); A.Reserve( localHeight*n ); for( Int iLoc=0; iLoc<localHeight; ++iLoc ) for( Int j=0; j<n; ++j ) A.QueueLocalUpdate( iLoc, j, alpha ); A.ProcessLocalQueues(); } }