本文整理汇总了C++中PartitionDown函数的典型用法代码示例。如果您正苦于以下问题:C++ PartitionDown函数的具体用法?C++ PartitionDown怎么用?C++ PartitionDown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PartitionDown函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PushCallStack
inline void
SingularValuesUpper
( DistMatrix<Complex<Real> >& A,
DistMatrix<Real,VR,STAR>& s,
double heightRatio=1.2 )
{
#ifndef RELEASE
PushCallStack("svd::SingularValuesUpper");
if( heightRatio <= 1.0 )
throw std::logic_error("Nonsensical switchpoint for SingularValues");
#endif
typedef Complex<Real> C;
const Grid& g = A.Grid();
const int m = A.Height();
const int n = A.Width();
if( m >= heightRatio*n )
{
DistMatrix<C,MD,STAR> t(g);
QR( A, t );
DistMatrix<C> AT(g),
AB(g);
PartitionDown
( A, AT,
AB, n );
MakeTrapezoidal( LEFT, UPPER, 0, AT );
SimpleSingularValuesUpper( AT, s );
}
else
{
SimpleSingularValuesUpper( A, s );
}
#ifndef RELEASE
PopCallStack();
#endif
}
开发者ID:certik,项目名称:Elemental,代码行数:35,代码来源:SVD.hpp
示例2: Explicit
inline void
Explicit( DistMatrix<F>& A, DistMatrix<F>& R, bool colPiv=false )
{
#ifndef RELEASE
CallStackEntry cse("qr::Explicit");
#endif
const Grid& g = A.Grid();
DistMatrix<F,MD,STAR> t(g);
if( colPiv )
{
DistMatrix<Int,VR,STAR> p(g);
QR( A, t, p );
}
else
{
QR( A, t );
}
DistMatrix<F> AT(g),
AB(g);
PartitionDown
( A, AT,
AB, Min(A.Height(),A.Width()) );
R = AT;
MakeTriangular( UPPER, R );
ExpandPackedReflectors( LOWER, VERTICAL, UNCONJUGATED, 0, A, t );
}
开发者ID:khalid-hasanov,项目名称:Elemental,代码行数:26,代码来源:Explicit.hpp
示例3: Householder
inline void
Householder( Matrix<F>& A, Matrix<F>& t )
{
#ifndef RELEASE
CallStackEntry entry("lq::Householder");
#endif
t.ResizeTo( Min(A.Height(),A.Width()), 1 );
// Matrix views
Matrix<F>
ATL, ATR, A00, A01, A02, ATopPan, ABottomPan,
ABL, ABR, A10, A11, A12,
A20, A21, A22;
Matrix<F>
tT, t0,
tB, t1,
t2;
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 );
View1x2( ATopPan, A11, A12 );
View1x2( ABottomPan, A21, A22 );
//--------------------------------------------------------------------//
PanelHouseholder( ATopPan, t1 );
ApplyQ( RIGHT, ADJOINT, ATopPan, t1, ABottomPan );
//--------------------------------------------------------------------//
SlidePartitionDown
( tT, t0,
t1,
/**/ /**/
tB, t2 );
SlidePartitionDownDiagonal
( ATL, /**/ ATR, A00, A01, /**/ A02,
/**/ A10, A11, /**/ A12,
/*************/ /******************/
ABL, /**/ ABR, A20, A21, /**/ A22 );
}
}
开发者ID:khalid-hasanov,项目名称:Elemental,代码行数:58,代码来源:Householder.hpp
示例4: entry
inline void
TrmmRUNA
( UnitOrNonUnit diag,
T alpha, const DistMatrix<T>& U,
DistMatrix<T>& X )
{
#ifndef RELEASE
CallStackEntry entry("internal::TrmmRUNA");
if( U.Grid() != X.Grid() )
throw std::logic_error("{U,X} must be distributed over the same grid");
#endif
const Grid& g = U.Grid();
DistMatrix<T>
XT(g), X0(g),
XB(g), X1(g),
X2(g);
DistMatrix<T,STAR,VC > X1_STAR_VC(g);
DistMatrix<T,STAR,MC > X1_STAR_MC(g);
DistMatrix<T,MR, STAR> Z1Trans_MR_STAR(g);
DistMatrix<T,MR, MC > Z1Trans_MR_MC(g);
X1_STAR_VC.AlignWith( U );
X1_STAR_MC.AlignWith( U );
Z1Trans_MR_STAR.AlignWith( U );
PartitionDown
( X, XT,
XB, 0 );
while( XT.Height() < X.Height() )
{
RepartitionDown
( XT, X0,
/**/ /**/
X1,
XB, X2 );
Z1Trans_MR_MC.AlignWith( X1 );
//--------------------------------------------------------------------//
X1_STAR_VC = X1;
X1_STAR_MC = X1_STAR_VC;
Zeros( Z1Trans_MR_STAR, X1.Width(), X1.Height() );
LocalTrmmAccumulateRUN
( TRANSPOSE, diag, alpha, U, X1_STAR_MC, Z1Trans_MR_STAR );
Z1Trans_MR_MC.SumScatterFrom( Z1Trans_MR_STAR );
Transpose( Z1Trans_MR_MC.Matrix(), X1.Matrix() );
//--------------------------------------------------------------------//
Z1Trans_MR_MC.FreeAlignments();
SlidePartitionDown
( XT, X0,
X1,
/**/ /**/
XB, X2 );
}
}
开发者ID:ahmadia,项目名称:Elemental-1,代码行数:58,代码来源:RUN.hpp
示例5: L
void L( Matrix<F>& A, Matrix<F>& t )
{
#ifndef RELEASE
CallStackEntry entry("hermitian_tridiag::L");
if( A.Height() != A.Width() )
LogicError("A must be square");
#endif
typedef BASE(F) R;
const Int tHeight = Max(A.Height()-1,0);
t.ResizeTo( tHeight, 1 );
// Matrix views
Matrix<F>
ATL, ATR, A00, a01, A02, alpha21T,
ABL, ABR, a10, alpha11, a12, a21B,
A20, a21, A22;
// Temporary matrices
Matrix<F> w21;
PartitionDownDiagonal
( A, ATL, ATR,
ABL, ABR, 0 );
while( ATL.Height()+1 < A.Height() )
{
RepartitionDownDiagonal
( ATL, /**/ ATR, A00, /**/ a01, A02,
/*************/ /**********************/
/**/ a10, /**/ alpha11, a12,
ABL, /**/ ABR, A20, /**/ a21, A22, 1 );
PartitionDown
( a21, alpha21T,
a21B, 1 );
//--------------------------------------------------------------------//
const F tau = Reflector( alpha21T, a21B );
const R epsilon1 = alpha21T.GetRealPart(0,0);
t.Set(A00.Height(),0,tau);
alpha21T.Set(0,0,F(1));
Zeros( w21, a21.Height(), 1 );
Hemv( LOWER, tau, A22, a21, F(0), w21 );
const F alpha = -tau*Dot( w21, a21 )/F(2);
Axpy( alpha, a21, w21 );
Her2( LOWER, F(-1), a21, w21, A22 );
alpha21T.Set(0,0,epsilon1);
//--------------------------------------------------------------------//
SlidePartitionDownDiagonal
( ATL, /**/ ATR, A00, a01, /**/ A02,
/**/ a10, alpha11, /**/ a12,
/*************/ /**********************/
ABL, /**/ ABR, A20, a21, /**/ A22 );
}
}
开发者ID:khalid-hasanov,项目名称:Elemental,代码行数:56,代码来源:L.hpp
示例6: HermitianTridiagL
inline void HermitianTridiagL( Matrix<R>& A )
{
#ifndef RELEASE
PushCallStack("HermitianTridiagL");
if( A.Height() != A.Width() )
throw std::logic_error("A must be square");
#endif
// Matrix views
Matrix<R>
ATL, ATR, A00, a01, A02, alpha21T,
ABL, ABR, a10, alpha11, a12, a21B,
A20, a21, A22;
// Temporary matrices
Matrix<R> w21;
PushBlocksizeStack( 1 );
PartitionDownDiagonal
( A, ATL, ATR,
ABL, ABR, 0 );
while( ATL.Height()+1 < A.Height() )
{
RepartitionDownDiagonal
( ATL, /**/ ATR, A00, /**/ a01, A02,
/*************/ /**********************/
/**/ a10, /**/ alpha11, a12,
ABL, /**/ ABR, A20, /**/ a21, A22 );
PartitionDown
( a21, alpha21T,
a21B, 1 );
w21.ResizeTo( a21.Height(), 1 );
//--------------------------------------------------------------------//
const R tau = Reflector( alpha21T, a21B );
const R epsilon1 = alpha21T.Get(0,0);
alpha21T.Set(0,0,R(1));
Symv( LOWER, tau, A22, a21, R(0), w21 );
const R alpha = -tau*Dot( w21, a21 )/R(2);
Axpy( alpha, a21, w21 );
Syr2( LOWER, R(-1), a21, w21, A22 );
alpha21T.Set(0,0,epsilon1);
//--------------------------------------------------------------------//
SlidePartitionDownDiagonal
( ATL, /**/ ATR, A00, a01, /**/ A02,
/**/ a10, alpha11, /**/ a12,
/*************/ /**********************/
ABL, /**/ ABR, A20, a21, /**/ A22 );
}
PopBlocksizeStack();
#ifndef RELEASE
PopCallStack();
#endif
}
开发者ID:certik,项目名称:Elemental,代码行数:56,代码来源:Local.hpp
示例7: DEBUG_ONLY
inline void
RepartitionDown
( DM& AT, DM& A0,
DM& A1,
DM& AB, DM& A2, Int A1Height=Blocksize() )
{
DEBUG_ONLY(CallStackEntry cse("RepartitionDown"))
View( A0, AT );
PartitionDown( AB, A1, A2, A1Height );
}
开发者ID:SamKChang,项目名称:madness,代码行数:10,代码来源:Repartition.hpp
示例8: cse
inline void
RepartitionDown
( DM& AT, DM& A0,
DM& A1,
DM& AB, DM& A2, Int A1Height )
{
#ifndef RELEASE
CallStackEntry cse("RepartitionDown [DistMatrix]");
#endif
View( A0, AT );
PartitionDown( AB, A1, A2, A1Height );
}
开发者ID:khalid-hasanov,项目名称:Elemental,代码行数:12,代码来源:repartition_impl.hpp
示例9: PushCallStack
inline void
LocalSymmetricAccumulateLU
( Orientation orientation, T alpha,
const DistMatrix<T>& A,
const DistMatrix<T,MC, STAR>& B_MC_STAR,
const DistMatrix<T,STAR,MR >& BAdjOrTrans_STAR_MR,
DistMatrix<T,MC, STAR>& Z_MC_STAR,
DistMatrix<T,MR, STAR>& Z_MR_STAR )
{
#ifndef RELEASE
PushCallStack("internal::LocalSymmetricAccumulateLU");
if( A.Grid() != B_MC_STAR.Grid() ||
B_MC_STAR.Grid() != BAdjOrTrans_STAR_MR.Grid() ||
BAdjOrTrans_STAR_MR.Grid() != Z_MC_STAR.Grid() ||
Z_MC_STAR.Grid() != Z_MR_STAR.Grid() )
throw std::logic_error
("{A,B,Z} must be distributed over the same grid");
if( A.Height() != A.Width() ||
A.Height() != B_MC_STAR.Height() ||
A.Height() != BAdjOrTrans_STAR_MR.Width() ||
A.Height() != Z_MC_STAR.Height() ||
A.Height() != Z_MR_STAR.Height() ||
B_MC_STAR.Width() != BAdjOrTrans_STAR_MR.Height() ||
BAdjOrTrans_STAR_MR.Height() != Z_MC_STAR.Width() ||
Z_MC_STAR.Width() != Z_MR_STAR.Width() )
{
std::ostringstream msg;
msg << "Nonconformal LocalSymmetricAccumulateLU: \n"
<< " A ~ " << A.Height() << " x " << A.Width() << "\n"
<< " B[MC,* ] ~ " << B_MC_STAR.Height() << " x "
<< B_MC_STAR.Width() << "\n"
<< " B^H/T[* ,MR] ~ " << BAdjOrTrans_STAR_MR.Height() << " x "
<< BAdjOrTrans_STAR_MR.Width() << "\n"
<< " Z[MC,* ] ~ " << Z_MC_STAR.Height() << " x "
<< Z_MC_STAR.Width() << "\n"
<< " Z[MR,* ] ` " << Z_MR_STAR.Height() << " x "
<< Z_MR_STAR.Width() << "\n";
throw std::logic_error( msg.str().c_str() );
}
if( B_MC_STAR.ColAlignment() != A.ColAlignment() ||
BAdjOrTrans_STAR_MR.RowAlignment() != A.RowAlignment() ||
Z_MC_STAR.ColAlignment() != A.ColAlignment() ||
Z_MR_STAR.ColAlignment() != A.RowAlignment() )
throw std::logic_error("Partial matrix distributions are misaligned");
#endif
const Grid& g = A.Grid();
DistMatrix<T>
ATL(g), ATR(g), A00(g), A01(g), A02(g),
ABL(g), ABR(g), A10(g), A11(g), A12(g),
A20(g), A21(g), A22(g);
DistMatrix<T> D11(g);
DistMatrix<T,MC,STAR>
BT_MC_STAR(g), B0_MC_STAR(g),
BB_MC_STAR(g), B1_MC_STAR(g),
B2_MC_STAR(g);
DistMatrix<T,STAR,MR>
BLAdjOrTrans_STAR_MR(g), BRAdjOrTrans_STAR_MR(g),
B0AdjOrTrans_STAR_MR(g), B1AdjOrTrans_STAR_MR(g),
B2AdjOrTrans_STAR_MR(g);
DistMatrix<T,MC,STAR>
ZT_MC_STAR(g), Z0_MC_STAR(g),
ZB_MC_STAR(g), Z1_MC_STAR(g),
Z2_MC_STAR(g);
DistMatrix<T,MR,STAR>
ZT_MR_STAR(g), Z0_MR_STAR(g),
ZB_MR_STAR(g), Z1_MR_STAR(g),
Z2_MR_STAR(g);
const int ratio = std::max( g.Height(), g.Width() );
PushBlocksizeStack( ratio*Blocksize() );
LockedPartitionDownDiagonal
( A, ATL, ATR,
ABL, ABR, 0 );
LockedPartitionDown
( B_MC_STAR, BT_MC_STAR,
BB_MC_STAR, 0 );
LockedPartitionRight
( BAdjOrTrans_STAR_MR, BLAdjOrTrans_STAR_MR, BRAdjOrTrans_STAR_MR, 0 );
PartitionDown
( Z_MC_STAR, ZT_MC_STAR,
ZB_MC_STAR, 0 );
PartitionDown
( Z_MR_STAR, ZT_MR_STAR,
ZB_MR_STAR, 0 );
while( ATL.Height() < A.Height() )
{
LockedRepartitionDownDiagonal
( ATL, /**/ ATR, A00, /**/ A01, A02,
/************/ /******************/
/**/ A10, /**/ A11, A12,
ABL, /**/ ABR, A20, /**/ A21, A22 );
LockedRepartitionDown
//.........这里部分代码省略.........
开发者ID:jimgoo,项目名称:Elemental,代码行数:101,代码来源:LU.hpp
示例10: LQ
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
}
开发者ID:ahmadia,项目名称:elemental,代码行数:80,代码来源:LQ.hpp
示例11: PushCallStack
inline void
GemmTTB
( Orientation orientationOfA,
Orientation orientationOfB,
T alpha, const DistMatrix<T>& A,
const DistMatrix<T>& B,
T beta, DistMatrix<T>& C )
{
#ifndef RELEASE
PushCallStack("internal::GemmTTB");
if( A.Grid() != B.Grid() || B.Grid() != C.Grid() )
throw std::logic_error
("{A,B,C} must be distributed over the same grid");
if( orientationOfA == NORMAL || orientationOfB == NORMAL )
throw std::logic_error
("GemmTTB expects A and B to be (Conjugate)Transposed");
if( A.Width() != C.Height() ||
B.Height() != C.Width() ||
A.Height() != B.Width() )
{
std::ostringstream msg;
msg << "Nonconformal GemmTTB: \n"
<< " A ~ " << A.Height() << " x " << A.Width() << "\n"
<< " B ~ " << B.Height() << " x " << B.Width() << "\n"
<< " C ~ " << C.Height() << " x " << C.Width() << "\n";
throw std::logic_error( msg.str().c_str() );
}
#endif
const Grid& g = A.Grid();
// Matrix views
DistMatrix<T> AL(g), AR(g),
A0(g), A1(g), A2(g);
DistMatrix<T> CT(g), C0(g),
CB(g), C1(g),
C2(g);
// Temporary distributions
DistMatrix<T,VR, STAR> A1_VR_STAR(g);
DistMatrix<T,STAR,MR > A1AdjOrTrans_STAR_MR(g);
DistMatrix<T,STAR,MC > D1_STAR_MC(g);
DistMatrix<T,MR, MC > D1_MR_MC(g);
DistMatrix<T> D1(g);
A1_VR_STAR.AlignWith( B );
A1AdjOrTrans_STAR_MR.AlignWith( B );
D1_STAR_MC.AlignWith( B );
// Start the algorithm
Scale( beta, C );
LockedPartitionRight( A, AL, AR, 0 );
PartitionDown
( C, CT,
CB, 0 );
while( AR.Width() > 0 )
{
LockedRepartitionRight
( AL, /**/ AR,
A0, /**/ A1, A2 );
RepartitionDown
( CT, C0,
/**/ /**/
C1,
CB, C2 );
D1.AlignWith( C1 );
Zeros( C1.Height(), C1.Width(), D1_STAR_MC );
//--------------------------------------------------------------------//
A1_VR_STAR = A1;
if( orientationOfA == ADJOINT )
A1AdjOrTrans_STAR_MR.AdjointFrom( A1_VR_STAR );
else
A1AdjOrTrans_STAR_MR.TransposeFrom( A1_VR_STAR );
// D1[*,MC] := alpha (A1[MR,*])^[T/H] (B[MC,MR])^[T/H]
// = alpha (A1^[T/H])[*,MR] (B^[T/H])[MR,MC]
LocalGemm
( NORMAL, orientationOfB,
alpha, A1AdjOrTrans_STAR_MR, B, T(0), D1_STAR_MC );
// C1[MC,MR] += scattered & transposed D1[*,MC] summed over grid rows
D1_MR_MC.SumScatterFrom( D1_STAR_MC );
D1 = D1_MR_MC;
Axpy( T(1), D1, C1 );
//--------------------------------------------------------------------//
D1.FreeAlignments();
SlideLockedPartitionRight
( AL, /**/ AR,
A0, A1, /**/ A2 );
SlidePartitionDown
( CT, C0,
C1,
/**/ /**/
CB, C2 );
}
#ifndef RELEASE
PopCallStack();
//.........这里部分代码省略.........
开发者ID:certik,项目名称:Elemental,代码行数:101,代码来源:TT.hpp
示例12: PushCallStack
inline void
LocalTrmmAccumulateLLT
( Orientation orientation, UnitOrNonUnit diag, T alpha,
const DistMatrix<T>& L,
const DistMatrix<T,MC,STAR>& X_MC_STAR,
DistMatrix<T,MR,STAR>& Z_MR_STAR )
{
#ifndef RELEASE
PushCallStack("internal::LocalTrmmAccumulateLLT");
if( L.Grid() != X_MC_STAR.Grid() ||
X_MC_STAR.Grid() != Z_MR_STAR.Grid() )
throw std::logic_error
("{L,X,Z} must be distributed over the same grid");
if( L.Height() != L.Width() ||
L.Height() != X_MC_STAR.Height() ||
L.Height() != Z_MR_STAR.Height() )
{
std::ostringstream msg;
msg << "Nonconformal LocalTrmmAccumulateLLT: " << "\n"
<< " L ~ " << L.Height() << " x " << L.Width() << "\n"
<< " X[MC,* ] ~ " << X_MC_STAR.Height() << " x "
<< X_MC_STAR.Width() << "\n"
<< " Z[MR,* ] ` " << Z_MR_STAR.Height() << " x "
<< Z_MR_STAR.Width() << "\n";
throw std::logic_error( msg.str().c_str() );
}
if( X_MC_STAR.ColAlignment() != L.ColAlignment() ||
Z_MR_STAR.ColAlignment() != L.RowAlignment() )
throw std::logic_error("Partial matrix distributions are misaligned");
#endif
const Grid& g = L.Grid();
// Matrix views
DistMatrix<T>
LTL(g), LTR(g), L00(g), L01(g), L02(g),
LBL(g), LBR(g), L10(g), L11(g), L12(g),
L20(g), L21(g), L22(g);
DistMatrix<T> D11(g);
DistMatrix<T,MC,STAR>
XT_MC_STAR(g), X0_MC_STAR(g),
XB_MC_STAR(g), X1_MC_STAR(g),
X2_MC_STAR(g);
DistMatrix<T,MR,STAR>
ZT_MR_STAR(g), Z0_MR_STAR(g),
ZB_MR_STAR(g), Z1_MR_STAR(g),
Z2_MR_STAR(g);
const int ratio = std::max( g.Height(), g.Width() );
PushBlocksizeStack( ratio*Blocksize() );
LockedPartitionDownDiagonal
( L, LTL, LTR,
LBL, LBR, 0 );
LockedPartitionDown
( X_MC_STAR, XT_MC_STAR,
XB_MC_STAR, 0 );
PartitionDown
( Z_MR_STAR, ZT_MR_STAR,
ZB_MR_STAR, 0 );
while( LTL.Height() < L.Height() )
{
LockedRepartitionDownDiagonal
( LTL, /**/ LTR, L00, /**/ L01, L02,
/*************/ /******************/
/**/ L10, /**/ L11, L12,
LBL, /**/ LBR, L20, /**/ L21, L22 );
LockedRepartitionDown
( XT_MC_STAR, X0_MC_STAR,
/**********/ /**********/
X1_MC_STAR,
XB_MC_STAR, X2_MC_STAR );
RepartitionDown
( ZT_MR_STAR, Z0_MR_STAR,
/**********/ /**********/
Z1_MR_STAR,
ZB_MR_STAR, Z2_MR_STAR );
D11.AlignWith( L11 );
//--------------------------------------------------------------------//
D11 = L11;
MakeTrapezoidal( LEFT, LOWER, 0, D11 );
if( diag == UNIT )
SetDiagonalToOne( D11 );
LocalGemm
( orientation, NORMAL, alpha, D11, X1_MC_STAR, T(1), Z1_MR_STAR );
LocalGemm
( orientation, NORMAL, alpha, L21, X2_MC_STAR, T(1), Z1_MR_STAR );
//--------------------------------------------------------------------//
D11.FreeAlignments();
SlideLockedPartitionDownDiagonal
( LTL, /**/ LTR, L00, L01, /**/ L02,
/**/ L10, L11, /**/ L12,
/*************/ /******************/
//.........这里部分代码省略.........
开发者ID:certik,项目名称:Elemental,代码行数:101,代码来源:LLT.hpp
示例13: PushCallStack
inline void
internal::ApplyPackedReflectorsLLVF
( Conjugation conjugation, int offset,
const DistMatrix<Complex<R>,MC,MR >& H,
const DistMatrix<Complex<R>,MD,STAR>& t,
DistMatrix<Complex<R>,MC,MR >& A )
{
#ifndef RELEASE
PushCallStack("internal::ApplyPackedReflectorsLLVF");
if( H.Grid() != t.Grid() || t.Grid() != A.Grid() )
throw std::logic_error
("{H,t,A} must be distributed over the same grid");
if( offset > 0 )
throw std::logic_error("Transforms cannot extend above matrix");
if( offset < -H.Height() )
throw std::logic_error("Transforms cannot extend below matrix");
if( H.Height() != A.Height() )
throw std::logic_error
("Height of transforms must equal height of target matrix");
if( t.Height() != H.DiagonalLength( offset ) )
throw std::logic_error("t must be the same length as H's offset diag.");
if( !t.AlignedWithDiagonal( H, offset ) )
throw std::logic_error("t must be aligned with H's 'offset' diagonal");
#endif
typedef Complex<R> C;
const Grid& g = H.Grid();
// Matrix views
DistMatrix<C,MC,MR>
HTL(g), HTR(g), H00(g), H01(g), H02(g), HPan(g), HPanCopy(g),
HBL(g), HBR(g), H10(g), H11(g), H12(g),
H20(g), H21(g), H22(g);
DistMatrix<C,MC,MR>
AT(g), A0(g),
AB(g), A1(g),
A2(g);
DistMatrix<C,MD,STAR>
tT(g), t0(g),
tB(g), t1(g),
t2(g);
DistMatrix<C,VC, STAR> HPan_VC_STAR(g);
DistMatrix<C,MC, STAR> HPan_MC_STAR(g);
DistMatrix<C,STAR,STAR> t1_STAR_STAR(g);
DistMatrix<C,STAR,STAR> SInv_STAR_STAR(g);
DistMatrix<C,STAR,MR > Z_STAR_MR(g);
DistMatrix<C,STAR,VR > Z_STAR_VR(g);
LockedPartitionDownDiagonal
( H, HTL, HTR,
HBL, HBR, 0 );
LockedPartitionDown
( t, tT,
tB, 0 );
PartitionDown
( A, AT,
AB, 0 );
while( HTL.Height() < H.Height() && HTL.Width() < H.Width() )
{
LockedRepartitionDownDiagonal
( HTL, /**/ HTR, H00, /**/ H01, H02,
/*************/ /******************/
/**/ H10, /**/ H11, H12,
HBL, /**/ HBR, H20, /**/ H21, H22 );
int HPanHeight = H11.Height() + H21.Height();
int HPanWidth = std::min( H11.Width(), std::max(HPanHeight+offset,0) );
HPan.LockedView( H, H00.Height(), H00.Width(), HPanHeight, HPanWidth );
LockedRepartitionDown
( tT, t0,
/**/ /**/
t1,
tB, t2, HPanWidth );
RepartitionDown
( AT, A0,
/**/ /**/
A1,
AB, A2 );
HPan_MC_STAR.AlignWith( AB );
Z_STAR_MR.AlignWith( AB );
Z_STAR_VR.AlignWith( AB );
Z_STAR_MR.ResizeTo( HPan.Width(), AB.Width() );
SInv_STAR_STAR.ResizeTo( HPan.Width(), HPan.Width() );
Zero( SInv_STAR_STAR );
//--------------------------------------------------------------------//
HPanCopy = HPan;
MakeTrapezoidal( LEFT, LOWER, offset, HPanCopy );
SetDiagonalToOne( LEFT, offset, HPanCopy );
HPan_VC_STAR = HPanCopy;
Herk
( UPPER, ADJOINT,
(C)1, HPan_VC_STAR.LockedLocalMatrix(),
(C)0, SInv_STAR_STAR.LocalMatrix() );
SInv_STAR_STAR.SumOverGrid();
t1_STAR_STAR = t1;
FixDiagonal( conjugation, t1_STAR_STAR, SInv_STAR_STAR );
//.........这里部分代码省略.........
开发者ID:ahmadia,项目名称:elemental,代码行数:101,代码来源:ApplyPackedReflectorsLLVF.hpp
示例14: PushCallStack
inline void
ApplyPackedReflectorsLUVF
( int offset, const Matrix<R>& H, Matrix<R>& A )
{
#ifndef RELEASE
PushCallStack("internal::ApplyPackedReflectorsLUVF");
if( offset < 0 || offset > H.Height() )
throw std::logic_error("Transforms out of bounds");
if( H.Width() != A.Height() )
throw std::logic_error
("Width of transforms must equal height of target matrix");
#endif
Matrix<R>
HTL, HTR, H00, H01, H02, HPan, HPanCopy,
HBL, HBR, H10, H11, H12,
H20, H21, H22;
Matrix<R>
AT, A0, ATop,
AB, A1,
A2;
Matrix<R> SInv, Z;
LockedPartitionDownDiagonal
( H, HTL, HTR,
HBL, HBR, 0 );
PartitionDown
( A, AT,
AB, 0 );
while( HTL.Height() < H.Height() && HTL.Width() < H.Width() )
{
LockedRepartitionDownDiagonal
( HTL, /**/ HTR, H00, /**/ H01, H02,
/*************/ /******************/
/**/ H10, /**/ H11, H12,
HBL, /**/ HBR, H20, /**/ H21, H22 );
const int HPanHeight = H01.Height() + H11.Height();
const int HPanOffset =
std::min( H11.Width(), std::max(offset-H00.Width(),0) );
const int HPanWidth = H11.Width()-HPanOffset;
HPan.LockedView( H, 0, H00.Width()+HPanOffset, HPanHeight, HPanWidth );
RepartitionDown
( AT, A0,
/**/ /**/
A1,
AB, A2 );
ATop.View2x1( A0,
A1 );
Zeros( HPan.Width(), ATop.Width(), Z );
Zeros( HPan.Width(), HPan.Width(), SInv );
//--------------------------------------------------------------------//
HPanCopy = HPan;
MakeTrapezoidal( RIGHT, UPPER, offset, HPanCopy );
SetDiagonalToOne( RIGHT, offset, HPanCopy );
Syrk( LOWER, TRANSPOSE, R(1), HPanCopy, R(0), SInv );
HalveMainDiagonal( SInv );
Gemm( TRANSPOSE, NORMAL, R(1), HPanCopy, ATop, R(0), Z );
Trsm( LEFT, LOWER, NORMAL, NON_UNIT, R(1), SInv, Z );
Gemm( NORMAL, NORMAL, R(-1), HPanCopy, Z, R(1), ATop );
//--------------------------------------------------------------------//
SlideLockedPartitionDownDiagonal
( HTL, /**/ HTR, H00, H01, /**/ H02,
/**/ H10, H11, /**/ H12,
/*************/ /******************/
HBL, /**/ HBR, H20, H21, /**/ H22 );
SlidePartitionDown
( AT, A0,
A1,
/**/ /**/
AB, A2 );
}
#ifndef RELEASE
PopCallStack();
#endif
}
开发者ID:certik,项目名称:Elemental,代码行数:82,代码来源:LUVF.hpp
示例15: PanelHouseholder
inline void
PanelHouseholder( DistMatrix<F>& A, DistMatrix<F,MD,STAR>& t )
{
#ifndef RELEASE
CallStackEntry entry("lq::PanelHouseholder");
if( A.Grid() != t.Grid() )
LogicError("{A,t} must be distributed over the same grid");
if( t.Height() != Min(A.Height(),A.Width()) || t.Width() != 1 )
LogicError
("t must be a vector of height equal to the minimum dimension of A");
if( !t.AlignedWithDiagonal( A, 0 ) )
LogicError("t must be aligned with A's main diagonal");
#endif
const Grid& g = A.Grid();
// Matrix views
DistMatrix<F>
ATL(g), ATR(g), A00(g), a01(g), A02(g), aTopRow(g), ABottomPan(g),
ABL(g), ABR(g), a10(g), alpha11(g), a12(g),
A20(g), a21(g), A22(g);
DistMatrix<F,MD,STAR>
tT(g), t0(g),
tB(g), tau1(g),
t2(g);
// Temporary distributions
DistMatrix<F> aTopRowConj(g);
DistMatrix<F,STAR,MR > aTopRowConj_STAR_MR(g);
DistMatrix<F,MC, STAR> z_MC_STAR(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, /**/ alpha11, a12,
ABL, /**/ ABR, A20, /**/ a21, A22, 1 );
RepartitionDown
( tT, t0,
/**/ /****/
tau1,
tB, t2, 1 );
View1x2( aTopRow, alpha11, a12 );
View1x2( ABottomPan, a21, A22 );
aTopRowConj_STAR_MR.AlignWith( ABottomPan );
z_MC_STAR.AlignWith( ABottomPan );
//--------------------------------------------------------------------//
// Compute the Householder reflector
const F tau = Reflector( alpha11, a12 );
tau1.Set( 0, 0, tau );
// Apply the Householder reflector
const bool myDiagonalEntry = ( g.Row() == alpha11.ColAlignment() &&
g.Col() == alpha11.RowAlignment() );
F alpha = 0;
if( myDiagonalEntry )
{
alpha = alpha11.GetLocal(0,0);
alpha11.SetLocal(0,0,1);
}
Conjugate( aTopRow, aTopRowConj );
aTopRowConj_STAR_MR = aTopRowConj;
Zeros( z_MC_STAR, ABottomPan.Height(), 1 );
LocalGemv
( NORMAL, F(1), ABottomPan, aTopRowConj_STAR_MR, F(0), z_MC_STAR );
z_MC_STAR.SumOverRow();
Ger
( -Conj(tau),
z_MC_STAR.LockedMatrix(),
aTopRowConj_STAR_MR.LockedMatrix(),
ABottomPan.Matrix() );
if( myDiagonalEntry )
alpha11.SetLocal(0,0,alpha);
//--------------------------------------------------------------------//
SlidePartitionDown
( tT, t0,
tau1,
/**/ /****/
tB, t2 );
SlidePartitionDownDiagonal
( ATL, /**/ ATR, A00, a01, /**/ A02,
/**/ a10, alpha11, /**/ a12,
/*************/ /**********************/
ABL, /**/ ABR, A20, a21, /**/ A22 );
}
}
开发者ID:khalid-hasanov,项目名称:Elemental,代码行数:97,代码来源:PanelHouseholder.hpp
示例16: entry
inline void
GolubReinschUpper
( DistMatrix<F>& A, DistMatrix<BASE(F),VR,STAR>& s, DistMatrix<F>& V )
{
#ifndef RELEASE
CallStackEntry entry("svd::GolubReinschUpper");
#endif
typedef BASE(F) Real;
const Int m = A.Height();
const Int n = A.Width();
const Int k = Min( m, n );
const Int offdiagonal = ( m>=n ? 1 : -1 );
const char uplo = ( m>=n ? 'U' : 'L' );
const Grid& g = A.Grid();
// Bidiagonalize A
DistMatrix<F,STAR,STAR> tP( g ), tQ( g );
Bidiag( A, tP, tQ );
// Grab copies of the diagonal and sub/super-diagonal of A
DistMatrix<Real,MD,STAR> d_MD_STAR(g), e_MD_STAR(g);
A.GetRealPartOfDiagonal( d_MD_STAR );
A.GetRealPartOfDiagonal( e_MD_STAR, offdiagonal );
// NOTE: lapack::BidiagQRAlg expects e to be of length k
DistMatrix<Real,STAR,STAR> d_STAR_STAR( d_MD_STAR ),
eHat_STAR_STAR( k, 1, g ),
e_STAR_STAR( g );
View( e_STAR_STAR, eHat_STAR_STAR, 0, 0, k-1, 1 );
e_STAR_STAR = e_MD_STAR;
// Initialize U and VAdj to the appropriate identity matrices
DistMatrix<F,VC,STAR> U_VC_STAR( g );
DistMatrix<F,STAR,VC> VAdj_STAR_VC( g );
U_VC_STAR.AlignWith( A );
VAdj_STAR_VC.AlignWith( V );
Identity( U_VC_STAR, m, k );
Identity( VAdj_STAR_VC, k, n );
// Compute the SVD of the bidiagonal matrix and accumulate the Givens
// rotations into our local portion of U and VAdj
Matrix<F>& ULoc = U_VC_STAR.Matrix();
Matrix<F>& VAdjLoc = VAdj_STAR_VC.Matrix();
lapack::BidiagQRAlg
( uplo, k, VAdjLoc.Width(), ULoc.Height(),
d_STAR_STAR.Buffer(), e_STAR_STAR.Buffer(),
VAdjLoc.Buffer(), VAdjLoc.LDim(),
ULoc.Buffer(), ULoc.LDim() );
// Make a copy of A (for the Householder vectors) and pull the necessary
// portions of U and VAdj into a standard matrix dist.
DistMatrix<F> B( A );
if( m >= n )
{
DistMatrix<F> AT(g), AB(g);
DistMatrix<F,VC,STAR> UT_VC_STAR(g), UB_VC_STAR(g);
PartitionDown( A, AT, AB, n );
PartitionDown( U_VC_STAR, UT_VC_STAR, UB_VC_STAR, n );
AT = UT_VC_STAR;
MakeZeros( AB );
Adjoint( VAdj_STAR_VC, V );
}
else
{
DistMatrix<F> VT(g), VB(g);
DistMatrix<F,STAR,VC> VAdjL_STAR_VC(g), VAdjR_STAR_VC(g);
PartitionDown( V, VT, VB, m );
PartitionRight( VAdj_STAR_VC, VAdjL_STAR_VC, VAdjR_STAR_VC, m );
Adjoint( VAdjL_STAR_VC, VT );
MakeZeros( VB );
}
// Backtransform U and V
bidiag::ApplyU( LEFT, NORMAL, B, tQ, A );
bidiag::ApplyV( LEFT, NORMAL, B, tP, V );
// Copy out the appropriate subset of the singular values
s = d_STAR_STAR;
}
开发者ID:khalid-hasanov,项目名称:Elemental,代码行数:79,代码来源:GolubReinsch.hpp
示例17: entry
void LSquare
( DistMatrix<Complex<R> >& A,
DistMatrix<Complex<R>,STAR,STAR>& t )
{
#ifndef RELEASE
CallStackEntry entry("hermitian_tridiag::LSquare");
if( A.Grid() != t.Grid() )
throw std::logic_error("{A,t} must be distributed over the same grid");
#endif
const Grid& g = A.Grid();
#ifndef RELEASE
if( g.Height() != g.Width() )
throw std::logic_error("The process grid must be square");
if( A.Height() != A.Width() )
throw std::logic_error("A must be square");
if( t.Viewing() )
throw std::logic_error("t must not be a view");
#endif
typedef Complex<R> C;
DistMatrix<C,MD,STAR> tDiag(g);
tDiag.AlignWithDiagonal( A, -1 );
tDiag.ResizeTo( A.Height()-1, 1 );
// Matrix views
DistMatrix<C>
ATL(g), ATR(g), A00(g), A01(g), A02(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);
// Temporary distributions
DistMatrix<C> WPan(g);
DistMatrix<C,STAR,STAR> t1_STAR_STAR(g);
DistMatrix<C,STAR,STAR> A11_STAR_STAR(g);
DistMatrix<C,MC, STAR> APan_MC_STAR(g), A11_MC_STAR(g),
A21_MC_STAR(g);
DistMatrix<C,MR, STAR> APan_MR_STAR(g), A11_MR_STAR(g),
A21_MR_STAR(g);
DistMatrix<C,MC, STAR> WPan_MC_STAR(g), W11_MC_STAR(g),
W21_MC_STAR(g);
DistMatrix<C,MR, STAR> WPan_MR_STAR(g), W11_MR_STAR(g),
W21_MR_STAR(g);
PartitionDownDiagonal
( A, ATL, ATR,
ABL, ABR, 0 );
PartitionDown
( tDiag, tT,
tB, 0 );
while( ATL.Height() < A.Height() )
{
RepartitionDownDiagonal
( ATL, /**/ ATR, A00, /**/ A01, A02,
/*************/ /******************/
/**/ A10, /**/ A11, A12,
ABL, /**/ ABR, A20, /**/ A21, A22 );
RepartitionDown
( tT, t0,
/**/ /**/
t1,
tB, t2 );
if( A22.Height() > 0 )
{
WPan.AlignWith( A11 );
APan_MC_STAR.AlignWith( A11 );
WPan_MC_STAR.AlignWith( A11 );
APan_MR_STAR.AlignWith( A11 );
WPan_MR_STAR.AlignWith( A11 );
//----------------------------------------------------------------//
WPan.ResizeTo( ABR.Height(), A11.Width() );
APan_MC_STAR.ResizeTo( ABR.Height(), A11.Width() );
WPan_MC_STAR.ResizeTo( ABR.Height(), A11.Width() );
APan_MR_STAR.ResizeTo( ABR.Height(), A11.Width() );
WPan_MR_STAR.ResizeTo( ABR.Height(), A11.Width() );
hermitian_tridiag::PanelLSquare
( ABR, WPan, t1,
APan_MC_STAR, APan_MR_STAR, WPan_MC_STAR, WPan_MR_STAR );
PartitionDown
( APan_MC_STAR, A11_MC_STAR,
A21_MC_STAR, A11.Height() );
PartitionDown
( APan_MR_STAR, A11_MR_STAR,
A21_MR_STAR, A11.Height() );
PartitionDown
( WPan_MC_STAR, W11_MC_STAR,
W21_MC_STAR, A11.Height() );
PartitionDown
( WPan_MR_STAR, W11_MR_STAR,
W21_MR_STAR, A11.Height() );
LocalTrr2k
( LOWER, ADJOINT, ADJOINT,
C(-1), A21_MC_STAR, W21_MR_STAR,
//.........这里部分代码省略.........
开发者ID:ahmadia,项目名称:Elemental-1,代码行数:101,代码来源:LSquare.hpp
示例18: PushCallStack
inline void
SymmLLC
( T alpha, const DistMatrix<T>& A, const DistMatrix<T>& B,
T beta, DistMatrix<T>& C )
{
#ifndef RELEASE
PushCallStack("internal::SymmLLC");
if( A.Grid() != B.Grid() || B.Grid() != C.Grid() )
throw std::logic_error
("{A,B,C} must be distributed over the same grid"
|
请发表评论