本文整理汇总了C++中Blocksize函数的典型用法代码示例。如果您正苦于以下问题:C++ Blocksize函数的具体用法?C++ Blocksize怎么用?C++ Blocksize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Blocksize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeTrapezoidal
void HermitianFromEVD
( UpperOrLower uplo,
Matrix<F>& A,
const Matrix<Base<F>>& w,
const Matrix<F>& Z )
{
DEBUG_CSE
Matrix<F> Z1Copy, Y1;
const Int m = Z.Height();
const Int n = Z.Width();
A.Resize( m, m );
if( uplo == LOWER )
MakeTrapezoidal( UPPER, A, 1 );
else
MakeTrapezoidal( LOWER, A, -1 );
const Int bsize = Blocksize();
for( Int k=0; k<n; k+=bsize )
{
const Int nb = Min(bsize,n-k);
auto Z1 = Z( ALL, IR(k,k+nb) );
auto w1 = w( IR(k,k+nb), ALL );
Y1 = Z1Copy = Z1;
DiagonalScale( RIGHT, NORMAL, w1, Y1 );
Trrk( uplo, NORMAL, ADJOINT, F(1), Z1Copy, Y1, F(1), A );
}
}
示例2: Blocksize
void LUNMedium
( const AbstractDistMatrix<F>& UPre, AbstractDistMatrix<F>& XPre,
bool checkIfSingular )
{
DEBUG_CSE
const Int m = XPre.Height();
const Int bsize = Blocksize();
const Grid& g = UPre.Grid();
DistMatrixReadProxy<F,F,MC,MR> UProx( UPre );
DistMatrixReadWriteProxy<F,F,MC,MR> XProx( XPre );
auto& U = UProx.GetLocked();
auto& X = XProx.Get();
DistMatrix<F,MC, STAR> U01_MC_STAR(g);
DistMatrix<F,STAR,STAR> U11_STAR_STAR(g);
DistMatrix<F,MR, STAR> X1Trans_MR_STAR(g);
const Int kLast = LastOffset( m, bsize );
Int k=kLast, kOld=m;
while( true )
{
const bool in2x2 = ( k>0 && U.Get(k,k-1) != F(0) );
if( in2x2 )
--k;
const Int nb = kOld-k;
const Range<Int> ind0( 0, k ),
ind1( k, k+nb );
auto U01 = U( ind0, ind1 );
auto U11 = U( ind1, ind1 );
auto X0 = X( ind0, ALL );
auto X1 = X( ind1, ALL );
U11_STAR_STAR = U11; // U11[* ,* ] <- U11[MC,MR]
X1Trans_MR_STAR.AlignWith( X0 );
Transpose( X1, X1Trans_MR_STAR );
// X1^T[MR,* ] := X1^T[MR,* ] U11^-T[* ,* ]
// = (U11^-1[* ,* ] X1[* ,MR])^T
LocalQuasiTrsm
( RIGHT, UPPER, TRANSPOSE,
F(1), U11_STAR_STAR, X1Trans_MR_STAR, checkIfSingular );
Transpose( X1Trans_MR_STAR, X1 );
U01_MC_STAR.AlignWith( X0 );
U01_MC_STAR = U01; // U01[MC,* ] <- U01[MC,MR]
// X0[MC,MR] -= U01[MC,* ] X1[* ,MR]
LocalGemm
( NORMAL, TRANSPOSE, F(-1), U01_MC_STAR, X1Trans_MR_STAR, F(1), X0 );
if( k == 0 )
break;
kOld = k;
k -= Min(bsize,k);
}
}
示例3: Blocksize
void UN_C
( T alpha,
const AbstractDistMatrix<T>& APre,
AbstractDistMatrix<T>& CPre,
bool conjugate=false )
{
EL_DEBUG_CSE
const Int r = APre.Width();
const Int bsize = Blocksize();
const Grid& g = APre.Grid();
DistMatrixReadProxy<T,T,MC,MR> AProx( APre );
DistMatrixReadWriteProxy<T,T,MC,MR> CProx( CPre );
auto& A = AProx.GetLocked();
auto& C = CProx.Get();
// Temporary distributions
DistMatrix<T,MC, STAR> A1_MC_STAR(g);
DistMatrix<T,VR, STAR> A1_VR_STAR(g);
DistMatrix<T,STAR,MR > A1Trans_STAR_MR(g);
A1_MC_STAR.AlignWith( C );
A1_VR_STAR.AlignWith( C );
A1Trans_STAR_MR.AlignWith( C );
for( Int k=0; k<r; k+=bsize )
{
const Int nb = Min(bsize,r-k);
auto A1 = A( ALL, IR(k,k+nb) );
A1_VR_STAR = A1_MC_STAR = A1;
Transpose( A1_VR_STAR, A1Trans_STAR_MR, conjugate );
LocalTrrk( UPPER, alpha, A1_MC_STAR, A1Trans_STAR_MR, T(1), C );
}
}
示例4: LUN
void LUN( const Matrix<F>& U, Matrix<F>& X, bool checkIfSingular )
{
DEBUG_CSE
const Int m = X.Height();
const Int bsize = Blocksize();
const Int kLast = LastOffset( m, bsize );
Int k=kLast, kOld=m;
while( true )
{
const bool in2x2 = ( k>0 && U.Get(k,k-1) != F(0) );
if( in2x2 )
--k;
const Int nb = kOld-k;
const Range<Int> ind0( 0, k ),
ind1( k, k+nb );
auto U01 = U( ind0, ind1 );
auto U11 = U( ind1, ind1 );
auto X0 = X( ind0, ALL );
auto X1 = X( ind1, ALL );
LUNUnb( U11, X1, checkIfSingular );
Gemm( NORMAL, NORMAL, F(-1), U01, X1, F(1), X0 );
if( k == 0 )
break;
kOld = k;
k -= Min(bsize,k);
}
}
示例5: Min
void
Householder
( Matrix<F>& A,
Matrix<F>& phase,
Matrix<Base<F>>& signature )
{
DEBUG_CSE
const Int m = A.Height();
const Int n = A.Width();
const Int minDim = Min(m,n);
phase.Resize( minDim, 1 );
signature.Resize( minDim, 1 );
const Int bsize = Blocksize();
for( Int k=0; k<minDim; k+=bsize )
{
const Int nb = Min(bsize,minDim-k);
const Range<Int> ind1( k, k+nb ),
indB( k, END ),
ind2( k+nb, END );
auto AB1 = A( indB, ind1 );
auto AB2 = A( indB, ind2 );
auto phase1 = phase( ind1, ALL );
auto sig1 = signature( ind1, ALL );
PanelHouseholder( AB1, phase1, sig1 );
ApplyQ( LEFT, ADJOINT, AB1, phase1, sig1, AB2 );
}
}
示例6: DEBUG_ONLY
inline void
HermitianFromEVD
( UpperOrLower uplo,
Matrix<F>& A,
const Matrix<Base<F>>& w,
const Matrix<F>& Z )
{
DEBUG_ONLY(CallStackEntry cse("HermitianFromEVD"))
Matrix<F> Z1Copy, Y1;
const Int m = Z.Height();
const Int n = Z.Width();
A.Resize( m, m );
if( uplo == LOWER )
MakeTrapezoidal( UPPER, A, 1 );
else
MakeTrapezoidal( LOWER, A, -1 );
const Int bsize = Blocksize();
for( Int k=0; k<n; k+=bsize )
{
const Int nb = Min(bsize,n-k);
auto Z1 = LockedView( Z, 0, k, m, nb );
auto w1 = LockedView( w, k, 0, nb, 1 );
Y1 = Z1Copy = Z1;
DiagonalScale( RIGHT, NORMAL, w1, Y1 );
Trrk( uplo, NORMAL, ADJOINT, F(1), Z1Copy, Y1, F(1), A );
}
}
示例7: LLN
void LLN( const Matrix<F>& L, Matrix<F>& X, bool checkIfSingular )
{
DEBUG_CSE
const Int m = X.Height();
const Int bsize = Blocksize();
for( Int k=0; k<m; k+=bsize )
{
const Int nbProp = Min(bsize,m-k);
const bool in2x2 = ( k+nbProp<m && L.Get(k+nbProp-1,k+nbProp) != F(0) );
const Int nb = ( in2x2 ? nbProp+1 : nbProp );
const Range<Int> ind1( k, k+nb ),
ind2( k+nb, m );
auto L11 = L( ind1, ind1 );
auto L21 = L( ind2, ind1 );
auto X1 = X( ind1, ALL );
auto X2 = X( ind2, ALL );
LLNUnb( L11, X1, checkIfSingular );
Gemm( NORMAL, NORMAL, F(-1), L21, X1, F(1), X2 );
}
}
示例8: DEBUG_ONLY
inline void
LUT
( Orientation orientation, F alpha,
Matrix<F>& U, const Matrix<F>& shifts, Matrix<F>& X )
{
DEBUG_ONLY(CSE cse("mstrsm::LUT"))
Scale( alpha, X );
const Int m = X.Height();
const Int bsize = Blocksize();
for( Int k=0; k<m; k+=bsize )
{
const Int nb = Min(bsize,m-k);
const Range<Int> ind1( k, k+nb ),
ind2( k+nb, m );
auto U11 = U( ind1, ind1 );
auto U12 = U( ind1, ind2 );
auto X1 = X( ind1, ALL );
auto X2 = X( ind2, ALL );
LeftUnb( UPPER, orientation, F(1), U11, shifts, X1 );
Gemm( orientation, NORMAL, F(-1), U12, X1, F(1), X2 );
}
}
示例9: cse
inline void
LockedRepartitionRight
( const DM& AL, const DM& AR,
DM& A0, DM& A1, DM& A2, Int A1Width=Blocksize() )
{
DEBUG_ONLY(CallStackEntry cse("LockedRepartitionRight"))
LockedView( A0, AL );
LockedPartitionRight( AR, A1, A2, A1Width );
}
示例10: CbSignal
virtual void CbSignal()
{
int c = CntOutSig(),rc;
if(stream) {
int sc = stream->getChannels();
rc = c < sc?c:sc;
if(rc)
stream->doGet(rc,OutSig(),Blocksize(),Samplerate());
else
stream->doWakeup();
}
else
rc = 0;
// clear remaining channels
while(rc < c) ZeroSamples(OutSig(rc++),Blocksize());
}
示例11: Blocksize
void LUNLarge
( UnitOrNonUnit diag,
const AbstractDistMatrix<F>& UPre,
AbstractDistMatrix<F>& XPre,
bool checkIfSingular )
{
EL_DEBUG_CSE
const Int m = XPre.Height();
const Int bsize = Blocksize();
const Grid& g = UPre.Grid();
DistMatrixReadProxy<F,F,MC,MR> UProx( UPre );
DistMatrixReadWriteProxy<F,F,MC,MR> XProx( XPre );
auto& U = UProx.GetLocked();
auto& X = XProx.Get();
DistMatrix<F,MC, STAR> U01_MC_STAR(g);
DistMatrix<F,STAR,STAR> U11_STAR_STAR(g);
DistMatrix<F,STAR,MR > X1_STAR_MR(g);
DistMatrix<F,STAR,VR > X1_STAR_VR(g);
const Int kLast = LastOffset( m, bsize );
for( Int k=kLast; k>=0; k-=bsize )
{
const Int nb = Min(bsize,m-k);
const Range<Int> ind0( 0, k ),
ind1( k, k+nb );
auto U01 = U( ind0, ind1 );
auto U11 = U( ind1, ind1 );
auto X0 = X( ind0, ALL );
auto X1 = X( ind1, ALL );
U11_STAR_STAR = U11; // U11[* ,* ] <- U11[MC,MR]
X1_STAR_VR = X1; // X1[* ,VR] <- X1[MC,MR]
// X1[* ,VR] := U11^-1[* ,* ] X1[* ,VR]
LocalTrsm
( LEFT, UPPER, NORMAL, diag, F(1), U11_STAR_STAR, X1_STAR_VR,
checkIfSingular );
X1_STAR_MR.AlignWith( X0 );
X1_STAR_MR = X1_STAR_VR; // X1[* ,MR] <- X1[* ,VR]
X1 = X1_STAR_MR; // X1[MC,MR] <- X1[* ,MR]
U01_MC_STAR.AlignWith( X0 );
U01_MC_STAR = U01; // U01[MC,* ] <- U01[MC,MR]
// X0[MC,MR] -= U01[MC,* ] X1[* ,MR]
LocalGemm( NORMAL, NORMAL, F(-1), U01_MC_STAR, X1_STAR_MR, F(1), X0 );
}
}
示例12: Blocksize
void LLNMedium
( const AbstractDistMatrix<F>& LPre,
AbstractDistMatrix<F>& XPre,
bool checkIfSingular )
{
DEBUG_CSE
const Int m = XPre.Height();
const Int bsize = Blocksize();
const Grid& g = LPre.Grid();
DistMatrixReadProxy<F,F,MC,MR> LProx( LPre );
DistMatrixReadWriteProxy<F,F,MC,MR> XProx( XPre );
auto& L = LProx.GetLocked();
auto& X = XProx.Get();
DistMatrix<F,STAR,STAR> L11_STAR_STAR(g);
DistMatrix<F,MC, STAR> L21_MC_STAR(g);
DistMatrix<F,MR, STAR> X1Trans_MR_STAR(g);
for( Int k=0; k<m; k+=bsize )
{
const Int nbProp = Min(bsize,m-k);
const bool in2x2 = ( k+nbProp<m && L.Get(k+nbProp-1,k+nbProp) != F(0) );
const Int nb = ( in2x2 ? nbProp+1 : nbProp );
const Range<Int> ind1( k, k+nb ),
ind2( k+nb, m );
auto L11 = L( ind1, ind1 );
auto L21 = L( ind2, ind1 );
auto X1 = X( ind1, ALL );
auto X2 = X( ind2, ALL );
L11_STAR_STAR = L11; // L11[* ,* ] <- L11[MC,MR]
X1Trans_MR_STAR.AlignWith( X2 );
Transpose( X1, X1Trans_MR_STAR );
// X1^T[MR,* ] := X1^T[MR,* ] L11^-T[* ,* ]
// = (L11^-1[* ,* ] X1[* ,MR])^T
LocalQuasiTrsm
( RIGHT, LOWER, TRANSPOSE,
F(1), L11_STAR_STAR, X1Trans_MR_STAR, checkIfSingular );
Transpose( X1Trans_MR_STAR, X1 );
L21_MC_STAR.AlignWith( X2 );
L21_MC_STAR = L21; // L21[MC,* ] <- L21[MC,MR]
// X2[MC,MR] -= L21[MC,* ] X1[* ,MR]
LocalGemm
( NORMAL, TRANSPOSE, F(-1), L21_MC_STAR, X1Trans_MR_STAR, F(1), X2 );
}
}
示例13: LowerBlocked
void LowerBlocked( Matrix<F>& A, Matrix<F>& householderScalars )
{
DEBUG_CSE
const Int n = A.Height();
householderScalars.Resize( Max(n-1,0), 1 );
Matrix<F> UB1, V01, VB1, G11;
const Int bsize = Blocksize();
for( Int k=0; k<n-1; k+=bsize )
{
const Int nb = Min(bsize,n-1-k);
const Range<Int> ind0( 0, k ),
ind1( k, k+nb ),
indB( k, n ), indR( k, n ),
ind2( k+nb, n );
auto ABR = A( indB, indR );
auto A22 = A( ind2, ind2 );
auto householderScalars1 = householderScalars( ind1, ALL );
UB1.Resize( n-k, nb );
VB1.Resize( n-k, nb );
G11.Resize( nb, nb );
hessenberg::LowerPanel( ABR, householderScalars1, UB1, VB1, G11 );
auto AB0 = A( indB, ind0 );
auto A2R = A( ind2, indR );
auto U21 = UB1( IR(nb,END), ALL );
auto V21 = VB1( IR(nb,END), ALL );
// AB0 := AB0 - (UB1 inv(G11)^H UB1^H AB0)
// = AB0 - (UB1 ((AB0^H UB1) inv(G11))^H)
// -------------------------------------------
Gemm( ADJOINT, NORMAL, F(1), AB0, UB1, V01 );
Trsm( RIGHT, UPPER, NORMAL, NON_UNIT, F(1), G11, V01 );
Gemm( NORMAL, ADJOINT, F(-1), UB1, V01, F(1), AB0 );
// A2R := (A2R - U21 inv(G11)^H VB1^H)(I - UB1 inv(G11) UB1^H)
// -----------------------------------------------------------
// A2R := A2R - U21 inv(G11)^H VB1^H
// (note: VB1 is overwritten)
Trsm( RIGHT, UPPER, NORMAL, NON_UNIT, F(1), G11, VB1 );
Gemm( NORMAL, ADJOINT, F(-1), U21, VB1, F(1), A2R );
// A2R := A2R - ((A2R UB1) inv(G11)) UB1^H
Gemm( NORMAL, NORMAL, F(1), A2R, UB1, F(0), V21 );
Trsm( RIGHT, UPPER, NORMAL, NON_UNIT, F(1), G11, V21 );
Gemm( NORMAL, ADJOINT, F(-1), V21, UB1, F(1), A2R );
}
}
示例14: DEBUG_ONLY
void
Householder
( AbstractDistMatrix<F>& APre,
AbstractDistMatrix<F>& householderScalarsPre,
AbstractDistMatrix<Base<F>>& signaturePre )
{
DEBUG_CSE
DEBUG_ONLY(AssertSameGrids( APre, householderScalarsPre, signaturePre ))
const Int m = APre.Height();
const Int n = APre.Width();
const Int minDim = Min(m,n);
const Int iOff = m-minDim;
const Int jOff = n-minDim;
DistMatrixReadWriteProxy<F,F,MC,MR> AProx( APre );
DistMatrixWriteProxy<F,F,MD,STAR>
householderScalarsProx( householderScalarsPre );
DistMatrixWriteProxy<Base<F>,Base<F>,MD,STAR> signatureProx( signaturePre );
auto& A = AProx.Get();
auto& householderScalars = householderScalarsProx.Get();
auto& signature = signatureProx.Get();
householderScalars.Resize( minDim, 1 );
signature.Resize( minDim, 1 );
const Int bsize = Blocksize();
const Int kLast = LastOffset( minDim, bsize );
for( Int k=kLast; k>=0; k-=bsize )
{
const Int nb = Min(bsize,minDim-k);
const Int ki = k + iOff;
const Int kj = k + jOff;
const Range<Int> ind0Vert( 0, ki ),
ind1( k, k+nb ),
ind1Vert( ki, ki+nb ),
indL( 0, kj+nb );
auto A0L = A( ind0Vert, indL );
auto A1L = A( ind1Vert, indL );
auto householderScalars1 = householderScalars( ind1, ALL );
auto sig1 = signature( ind1, ALL );
PanelHouseholder( A1L, householderScalars1, sig1 );
ApplyQ( RIGHT, ADJOINT, A1L, householderScalars1, sig1, A0L );
}
}
示例15: AProx
void HermitianFromEVD
( UpperOrLower uplo,
AbstractDistMatrix<F>& APre,
const AbstractDistMatrix<Base<F>>& wPre,
const AbstractDistMatrix<F>& ZPre )
{
DEBUG_CSE
typedef Base<F> Real;
DistMatrixWriteProxy<F,F,MC,MR> AProx( APre );
DistMatrixReadProxy<Real,Real,VR,STAR> wProx( wPre );
DistMatrixReadProxy<F,F,MC,MR> ZProx( ZPre );
auto& A = AProx.Get();
auto& w = wProx.GetLocked();
auto& Z = ZProx.GetLocked();
const Grid& g = A.Grid();
DistMatrix<F,MC, STAR> Z1_MC_STAR(g);
DistMatrix<F,VR, STAR> Z1_VR_STAR(g);
DistMatrix<F,STAR,MR > Z1Adj_STAR_MR(g);
const Int m = Z.Height();
const Int n = Z.Width();
A.Resize( m, m );
if( uplo == LOWER )
MakeTrapezoidal( UPPER, A, 1 );
else
MakeTrapezoidal( LOWER, A, -1 );
const Int bsize = Blocksize();
for( Int k=0; k<n; k+=bsize )
{
const Int nb = Min(bsize,n-k);
auto Z1 = Z( ALL, IR(k,k+nb) );
auto w1 = w( IR(k,k+nb), ALL );
Z1_MC_STAR.AlignWith( A );
Z1_MC_STAR = Z1;
Z1_VR_STAR.AlignWith( A );
Z1_VR_STAR = Z1_MC_STAR;
DiagonalScale( RIGHT, NORMAL, w1, Z1_VR_STAR );
Z1Adj_STAR_MR.AlignWith( A );
Adjoint( Z1_VR_STAR, Z1Adj_STAR_MR );
LocalTrrk( uplo, F(1), Z1_MC_STAR, Z1Adj_STAR_MR, F(1), A );
}
}