inline void RepartitionUpDiagonal ( DM& ATL, DM& ATR, DM& A00, DM& A01, DM& A02, DM& A10, DM& A11, DM& A12, DM& ABL, DM& ABR, DM& A20, DM& A21, DM& A22, Int bsize=Blocksize() ) { DEBUG_ONLY(CallStackEntry cse("RepartitionUpDiagonal")) PartitionUpOffsetDiagonal ( ATL.Width()-ATL.Height(), ATL, A00, A01, A10, A11, bsize ); PartitionUp( ATR, A02, A12, A11.Height() ); PartitionLeft( ABL, A20, A21, A11.Width() ); View( A22, ABR ); }
inline void LockedRepartitionUpDiagonal ( const DM& ATL, const DM& ATR, DM& A00, DM& A01, DM& A02, DM& A10, DM& A11, DM& A12, const DM& ABL, const DM& ABR, DM& A20, DM& A21, DM& A22, Int bsize ) { #ifndef RELEASE CallStackEntry cse("LockedRepartitionUpDiagonal [DistMatrix]"); #endif LockedPartitionUpOffsetDiagonal ( ATL.Width()-ATL.Height(), ATL, A00, A01, A10, A11, bsize ); LockedPartitionUp( ATR, A02, A12, A11.Height() ); LockedPartitionLeft( ABL, A20, A21, A11.Width() ); LockedView( A22, ABR ); }
inline void LockedPartitionDown ( const DM& A, DM& AT, DM& AB, Int heightAT ) { #ifndef RELEASE PushCallStack("LockedPartitionDown [DistMatrix]"); if( heightAT < 0 ) throw std::logic_error("Height of top partition must be non-negative"); #endif heightAT = std::min(heightAT,A.Height()); const Int heightAB = A.Height()-heightAT; LockedView( AT, A, 0, 0, heightAT, A.Width() ); LockedView( AB, A, heightAT, 0, heightAB, A.Width() ); #ifndef RELEASE PopCallStack(); #endif }
inline void PartitionUp ( DM& A, DM& AT, DM& AB, Int heightAB ) { #ifndef RELEASE PushCallStack("PartitionUp [DistMatrix]"); if( heightAB < 0 ) throw std::logic_error ("Height of bottom partition must be non-negative"); #endif heightAB = std::min(heightAB,A.Height()); const Int heightAT = A.Height()-heightAB; View( AT, A, 0, 0, heightAT, A.Width() ); View( AB, A, heightAT, 0, heightAB, A.Width() ); #ifndef RELEASE PopCallStack(); #endif }
inline void LockedPartitionDownLeftDiagonal ( const DM& A, DM& ATL, DM& ATR, DM& ABL, DM& ABR, Int diagATL ) { #ifndef RELEASE PushCallStack("LockedPartitionDownLeftDiagonal [DistMatrix]"); if( diagATL < 0 ) throw std::logic_error("Top-left size must be non-negative"); #endif const Int minDim = std::min(A.Height(),A.Width()); diagATL = std::min(diagATL,minDim); const Int heightABR = A.Height()-diagATL; const Int widthABR = A.Width()-diagATL; LockedView( ATL, A, 0, 0, diagATL, diagATL ); LockedView( ATR, A, 0, diagATL, diagATL, widthABR ); LockedView( ABL, A, diagATL, 0, heightABR, diagATL ); LockedView( ABR, A, diagATL, diagATL, heightABR, widthABR ); #ifndef RELEASE PopCallStack(); #endif }
inline void LockedPartitionUpRightDiagonal ( const DM& A, DM& ATL, DM& ATR, DM& ABL, DM& ABR, Int diagABR ) { #ifndef RELEASE PushCallStack("LockedPartitionUpRightDiagonal [DistMatrix]"); if( diagABR < 0 ) throw std::logic_error("Bottom-right size must be non-negative"); #endif const Int minDim = std::min(A.Height(),A.Width()); diagABR = std::min(diagABR,minDim); const Int remHeight = A.Height()-diagABR; const Int remWidth = A.Width()-diagABR; LockedView( ATL, A, 0, 0, remHeight, remWidth ); LockedView( ATR, A, 0, remWidth, remHeight, diagABR ); LockedView( ABL, A, remHeight, 0, diagABR, remWidth ); LockedView( ABR, A, remHeight, remWidth, diagABR, diagABR ); #ifndef RELEASE PopCallStack(); #endif }
inline void RepartitionDownDiagonal ( DM& ATL, DM& ATR, DM& A00, DM& A01, DM& A02, DM& A10, DM& A11, DM& A12, DM& ABL, DM& ABR, DM& A20, DM& A21, DM& A22, Int bsize=Blocksize() ) { DEBUG_ONLY(CallStackEntry cse("RepartitionDownDiagonal")) View( A00, ATL ); PartitionDownDiagonal( ABR, A11, A12, A21, A22, bsize ); PartitionDown( ABL, A10, A20, A11.Height() ); PartitionRight( ATR, A01, A02, A11.Width() ); }
inline void PartitionDownRightDiagonal ( DM& A, DM& ATL, DM& ATR, DM& ABL, DM& ABR, Int diagATL ) { #ifndef RELEASE PushCallStack("PartitionDownRightDiagonal [DistMatrix]"); if( diagATL < 0 ) throw std::logic_error("Top-left size must be non-negative"); #endif const Int minDim = std::min( A.Height(), A.Width() ); diagATL = std::min(diagATL,minDim); const Int sizeABR = minDim-diagATL; const Int remHeight = A.Height()-sizeABR; const Int remWidth = A.Width()-sizeABR; View( ATL, A, 0, 0, remHeight, remWidth ); View( ATR, A, 0, remWidth, remHeight, sizeABR ); View( ABL, A, remHeight, 0, sizeABR, remWidth ); View( ABR, A, remHeight, remWidth, sizeABR, sizeABR ); #ifndef RELEASE PopCallStack(); #endif }
inline void RepartitionDownDiagonal ( DM& ATL, DM& ATR, DM& A00, DM& A01, DM& A02, DM& A10, DM& A11, DM& A12, DM& ABL, DM& ABR, DM& A20, DM& A21, DM& A22, Int bsize ) { #ifndef RELEASE CallStackEntry cse("RepartitionDownDiagonal [DistMatrix]"); #endif View( A00, ATL ); PartitionDownDiagonal( ABR, A11, A12, A21, A22, bsize ); PartitionDown( ABL, A10, A20, A11.Height() ); PartitionRight( ATR, A01, A02, A11.Width() ); }
inline void LockedPartitionRight( const DM& A, DM& AL, DM& AR, Int widthAL ) { #ifndef RELEASE PushCallStack("LockedPartitionRight [DistMatrix]"); if( widthAL < 0 ) throw std::logic_error("Width of left partition must be non-negative"); #endif widthAL = std::min(widthAL,A.Width()); const Int widthAR = A.Width()-widthAL; LockedView( AL, A, 0, 0, A.Height(), widthAL ); LockedView( AR, A, 0, widthAL, A.Height(), widthAR ); #ifndef RELEASE PopCallStack(); #endif }
inline void PartitionLeft( DM& A, DM& AL, DM& AR, Int widthAR ) { #ifndef RELEASE PushCallStack("PartitionLeft [DistMatrix]"); if( widthAR < 0 ) throw std::logic_error("Width of right partition must be non-negative"); #endif widthAR = std::min(widthAR,A.Width()); const Int widthAL = A.Width()-widthAR; View( AL, A, 0, 0, A.Height(), widthAL ); View( AR, A, 0, widthAL, A.Height(), widthAR ); #ifndef RELEASE PopCallStack(); #endif }