本文整理汇总了C++中Permutation::ExplicitMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ Permutation::ExplicitMatrix方法的具体用法?C++ Permutation::ExplicitMatrix怎么用?C++ Permutation::ExplicitMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permutation
的用法示例。
在下文中一共展示了Permutation::ExplicitMatrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Output
void TestLDL
( Int m,
bool conjugated,
Int nbLocal,
bool correctness,
bool print )
{
Matrix<Field> A, AOrig;
Output("Testing with ",TypeName<Field>());
PushIndent();
SetLocalTrrkBlocksize<Field>( nbLocal );
if( conjugated )
HermitianUniformSpectrum( A, m, -100, 100 );
else
Uniform( A, m, m );
if( correctness )
AOrig = A;
if( print )
Print( A, "A" );
Output("Starting LDL^[T/H] factorization...");
Timer timer;
timer.Start();
Matrix<Field> dSub;
Permutation p;
LDL( A, dSub, p, conjugated );
const double runTime = timer.Stop();
const double realGFlops = 1./3.*Pow(double(m),3.)/(1.e9*runTime);
const double gFlops = IsComplex<Field>::value ? 4*realGFlops : realGFlops;
Output(runTime," seconds (",gFlops," GFlop/s)");
if( print )
{
Print( A, "A after factorization" );
Matrix<Int> P;
p.ExplicitMatrix( P );
Print( P, "P" );
}
if( correctness )
TestCorrectness( conjugated, print, A, dSub, p, AOrig );
PopIndent();
}
示例2: QR
void Explicit
( Matrix<F>& A,
Matrix<F>& R,
Matrix<Int>& OmegaFull,
bool thinQR,
const QRCtrl<Base<F>>& ctrl )
{
DEBUG_CSE
Matrix<F> householderScalars;
Matrix<Base<F>> signature;
Permutation Omega;
QR( A, householderScalars, signature, Omega, ctrl );
const Int m = A.Height();
const Int n = A.Width();
const Int numIts = householderScalars.Height();
auto AT = A( IR(0,numIts), IR(0,n) );
R = AT;
MakeTrapezoidal( UPPER, R );
if( thinQR )
{
A.Resize( m, numIts );
ExpandPackedReflectors
( LOWER, VERTICAL, CONJUGATED, 0, A, householderScalars );
DiagonalScale( RIGHT, NORMAL, signature, A );
}
else
{
auto ACopy = A;
// TODO: Use an extension of ExpandPackedReflectors to make this faster
Identity( A, A.Height(), A.Height() );
qr::ApplyQ( LEFT, NORMAL, ACopy, householderScalars, signature, A );
}
Omega.ExplicitMatrix( OmegaFull );
}