本文整理匯總了C++中DistMatrix::AlignWithDiagonal方法的典型用法代碼示例。如果您正苦於以下問題:C++ DistMatrix::AlignWithDiagonal方法的具體用法?C++ DistMatrix::AlignWithDiagonal怎麽用?C++ DistMatrix::AlignWithDiagonal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DistMatrix
的用法示例。
在下文中一共展示了DistMatrix::AlignWithDiagonal方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: entry
inline void
Householder( DistMatrix<F>& A, DistMatrix<F,MD,STAR>& t )
{
#ifndef RELEASE
CallStackEntry entry("qr::Householder");
if( A.Grid() != t.Grid() )
LogicError("{A,s} must be distributed over the same grid");
#endif
const Grid& g = A.Grid();
if( t.Viewing() )
{
if( !t.AlignedWithDiagonal( A ) )
LogicError("t was not aligned with A");
}
else
{
t.AlignWithDiagonal( A );
}
t.ResizeTo( Min(A.Height(),A.Width()), 1 );
// Matrix views
DistMatrix<F>
ATL(g), ATR(g), A00(g), A01(g), A02(g), ALeftPan(g), ARightPan(g),
ABL(g), ABR(g), A10(g), A11(g), A12(g),
A20(g), A21(g), A22(g);
DistMatrix<F,MD,STAR>
tT(g), t0(g),
tB(g), t1(g),
t2(g);
PartitionDownDiagonal
( A, ATL, ATR,
ABL, ABR, 0 );
PartitionDown
( t, tT,
tB, 0 );
while( ATL.Height() < A.Height() && ATL.Width() < A.Width() )
{
RepartitionDownDiagonal
( ATL, /**/ ATR, A00, /**/ A01, A02,
/*************/ /******************/
/**/ A10, /**/ A11, A12,
ABL, /**/ ABR, A20, /**/ A21, A22 );
RepartitionDown
( tT, t0,
/**/ /**/
t1,
tB, t2 );
View2x1
( ALeftPan, A11,
A21 );
View2x1
( ARightPan, A12,
A22 );
//--------------------------------------------------------------------//
PanelHouseholder( ALeftPan, t1 );
ApplyQ( LEFT, ADJOINT, ALeftPan, t1, ARightPan );
//--------------------------------------------------------------------//
SlidePartitionDown
( tT, t0,
t1,
/**/ /**/
tB, t2 );
SlidePartitionDownDiagonal
( ATL, /**/ ATR, A00, A01, /**/ A02,
/**/ A10, A11, /**/ A12,
/*************/ /******************/
ABL, /**/ ABR, A20, A21, /**/ A22 );
}
}
示例2: logic_error
inline void
LQ( DistMatrix<Complex<R>,MC,MR >& A,
DistMatrix<Complex<R>,MD,STAR>& t )
{
#ifndef RELEASE
PushCallStack("LQ");
if( A.Grid() != t.Grid() )
throw std::logic_error("{A,t} must be distributed over the same grid");
#endif
typedef Complex<R> C;
const Grid& g = A.Grid();
if( t.Viewing() )
{
if( !t.AlignedWithDiagonal( A ) )
throw std::logic_error("t was not aligned with A");
if( t.Height() != std::min(A.Height(),A.Width()) || t.Width() != 1 )
throw std::logic_error("t was not the appropriate shape");
}
else
{
t.AlignWithDiagonal( A );
t.ResizeTo( std::min(A.Height(),A.Width()), 1 );
}
// Matrix views
DistMatrix<C,MC,MR>
ATL(g), ATR(g), A00(g), A01(g), A02(g), ATopPan(g), ABottomPan(g),
ABL(g), ABR(g), A10(g), A11(g), A12(g),
A20(g), A21(g), A22(g);
DistMatrix<C,MD,STAR>
tT(g), t0(g),
tB(g), t1(g),
t2(g);
PartitionDownLeftDiagonal
( A, ATL, ATR,
ABL, ABR, 0 );
PartitionDown
( t, tT,
tB, 0 );
while( ATL.Height() < A.Height() && ATL.Width() < A.Width() )
{
RepartitionDownDiagonal
( ATL, /**/ ATR, A00, /**/ A01, A02,
/*************/ /******************/
/**/ A10, /**/ A11, A12,
ABL, /**/ ABR, A20, /**/ A21, A22 );
RepartitionDown
( tT, t0,
/**/ /**/
t1,
tB, t2 );
ATopPan.View1x2( A11, A12 );
ABottomPan.View1x2( A21, A22 );
//--------------------------------------------------------------------//
internal::PanelLQ( ATopPan, t1 );
ApplyPackedReflectors
( RIGHT, UPPER, HORIZONTAL, FORWARD, CONJUGATED,
0, ATopPan, t1, ABottomPan );
//--------------------------------------------------------------------//
SlidePartitionDown
( tT, t0,
t1,
/**/ /**/
tB, t2 );
SlidePartitionDownDiagonal
( ATL, /**/ ATR, A00, A01, /**/ A02,
/**/ A10, A11, /**/ A12,
/*************/ /******************/
ABL, /**/ ABR, A20, A21, /**/ A22 );
}
#ifndef RELEASE
PopCallStack();
#endif
}