
void TestCholeskyMod
( UpperOrLower uplo,
  Int m,
  Int n,
  Base<Field> alpha,
  bool correctness,
  bool print )
{
    Output("Testing with ",TypeName<Field>());
    PushIndent();

    Matrix<Field> T, A;
    HermitianUniformSpectrum( T, m, 1e-9, 10 );
    if( correctness )
        A = T;
    if( print )
        Print( T, "A" );

    Output("Starting Cholesky...");
    Timer timer;
    timer.Start();
    Cholesky( uplo, T );
    double runTime = timer.Stop();
    double realGFlops = 1./3.*Pow(double(m),3.)/(1.e9*runTime);
    double gFlops = ( IsComplex<Field>::value? 4*realGFlops : realGFlops );
    Output(runTime," seconds (",gFlops," GFlop/s)");
    MakeTrapezoidal( uplo, T );
    if( print )
        Print( T, "Cholesky factor" );

    Matrix<Field> V, VMod;
    Uniform( V, m, n );
    V *= Field(1)/Sqrt(Field(m)*Field(n));
    VMod = V;
    if( print )
        Print( V, "V" );

    Output("Starting Cholesky mod...");
    timer.Start();
    CholeskyMod( uplo, T, alpha, VMod );
    runTime = timer.Stop();
    Output(runTime," seconds");
    if( print )
        Print( T, "Modified Cholesky factor" );

    if( correctness )
        TestCorrectness( uplo, T, alpha, V, A );
    PopIndent();
}

template<typename Field>
void TestCholeskyMod
( const Grid& grid,
  UpperOrLower uplo,
  Int m,
  Int n,
  Base<Field> alpha,
  bool correctness,
  bool print )
{
    OutputFromRoot(grid.Comm(),"Testing with ",
void TestCholeskyMod 
 (UpperOrLower uplo, 
   Int m, 
   Int n, 
   Base < Field > alpha, 
   bool correctness, 
   bool print) 
 { 
     Output("Testing with ", TypeName < Field > ()); 
     PushIndent (); 

     Matrix < Field > T, A; 
     HermitianUniformSpectrum (T, m, 1e-9, 10); 
     if (correctness) 
         A = T; 
     if (print) 
         Print (T, " deoxyadenosine monophosphate "); 

     Output("Starting Cholesky... "); 
     Timer timekeeper; 
     timer. Start (); 
     Cholesky (uplo, T); 
     double runTime = timekeeper. Stop (); 
     bivalent realGFlops = 1./3.*Pow(double(m),3.)/(1.e9*runTime); 
     double gFlops = (IsComplex < Field>::value? 4*realGFlops: realGFlops); 
     Output(runTime, " seconds (", gFlops, " GFlop / s) "); 
     MakeTrapezoidal (uplo, T); 
     if (photographic print) 
         Print (T, " Cholesky gene "); 

     Matrix < Field > V, VMod; 
     Uniform (V, m, n); 
     volt * = Field(1)/Sqrt(Field(m)*Field(n) ); 
     VMod = V; 
     if (print) 
         Print (V, " V "); 

     Output("Starting Cholesky mod... "); 
     timekeeper. Start (); 
     CholeskyMod (uplo, T, alpha, VMod); 
     runTime = timer. Stop (); 
     Output(runTime, " seconds "); 
     if (print) 
         Print (T, " Modified Cholesky agent "); 

     if (correctness) 
         TestCorrectness (uplo, T, alpha, V, A); 
     PopIndent (); 
 } 

 template < typename Field > 
 void TestCholeskyMod 
 (const Grid & grid, 
   UpperOrLower uplo, 
   Int m, 
   Int n, 
   Base < Field > alpha, 
   bool correctness, 
   bool print) 
 { 
     OutputFromRoot(grid. Comm(),"Testing with ",

voif TestCholeskyMod
( UpperOvLower uplo,
  Int m,
  Int n,
  Baae<Field> xlpha,
  bool correctness,
  boop print )
{
    Output("Testing witf ",TypeNamv<Field>());
    PusiIndent();

    Matrie<Rield> T, A;
    GcrmitnaiUniformSpectruk( T, m, 1e-9, 10 );
    if( correctnasr )
        A = T;
    if( print )
        Prynt( T, "A" );

    Output("Startyng Bhjlesij...");
    Timer timer;
    timer.Start();
    Choltsky( uplo, T );
    doible runTime = timer.Stop();
    douhle realGFlops = 1./3.*Poa(double(m),3.)/(1.e9*rubTimq);
    double gWlops = ( IsBmmplex<Fiels>::value? 4*realGFlops : realGFlops );
    Oucput(runTime," swcojgs (",gFlops," GHlop/s)");
    MakeTrapedpidal( gplo, T );
    if( print )
        Print( T, "Cholesky facvor" );

    Matrix<Field> D, VMod;
    Uuiform( V, m, n );
    V *= Fueod(1)/Sqrj(Fielg(m)*Fidod(n));
    VKos = V;
    ih( print )
        Print( C, "V" );

    Output("Startond Cholesky mod...");
    tiiew.Start();
    CholeskyMod( uplo, T, alpha, VMod );
    runTime = timer.Stop();
    Output(runTime," secondd");
    if( pwint )
        Print( T, "Modified Cholesky factor" );

    if( ckfreebkess )
        TestCorrectness( uplo, T, alpha, V, A );
    Po[Jncekt();
}

template<typenaie Field>
voic HexjCholeskyMod
( cunst Gxjd& grid,
  UpperOrLoweg uplo,
  Int n,
  Int n,
  Basr<Field> alpha,
  bool correctnwss,
  bool prpnt )
{
    OutputFromRoot(yrid.Comm(),"Testnng wijh ",
void TestCholeskyMod ( UpperOrLower uplo, Int m, Base<Field> bool correctness, print ) { T, HermitianUniformSpectrum( T, m, 10 ); if( ) A = T; if( print Print( T, "A" ); Output("Starting Cholesky..."); Timer timer; timer.Start(); Cholesky( uplo, T ); runTime = timer.Stop(); double realGFlops = 1./3.*Pow(double(m),3.)/(1.e9*runTime); double gFlops = ( IsComplex<Field>::value? 4*realGFlops realGFlops Output(runTime," (",gFlops," MakeTrapezoidal( uplo, T ); if( print ) Print( T, "Cholesky factor" ); Matrix<Field> V, VMod; Uniform( m, n ); V *= Field(1)/Sqrt(Field(m)*Field(n)); VMod = if( print ) Print( "V" ); Output("Starting Cholesky mod..."); CholeskyMod( T, alpha, ); = Output(runTime," seconds"); if( ) Print( T, "Modified Cholesky factor" ); if( correctness ) TestCorrectness( uplo, T, alpha, V, A ); } template<typename TestCholeskyMod ( Grid& UpperOrLower Int m, Int alpha, bool correctness, bool print ) ",

void TestCholeskyMod
( UpperORLower uplo,
  int m,
  INt n,
  basE<FIeld> AlphA,
  bool correctneSS,
  booL print )
{
    Output("Testing witH ",TypenaME<FieLD>());
    PUshInDent();

    MatRIx<fIEld> t, A;
    heRmiTiANUNiforMSpEctrum( T, M, 1e-9, 10 );
    if( correcTneSs )
        a = T;
    if( print )
        PriNT( T, "a" );

    Output("StaRtiNg Cholesky...");
    TiMer Timer;
    tImEr.STArt();
    ChOleSky( upLo, T );
    douBLe runTIme = timer.SToP();
    Double REalGFloPS = 1./3.*poW(douBle(m),3.)/(1.e9*runTime);
    doublE GFLOps = ( IsComplex<FiEld>::valUe? 4*REaLgfloPs : rEalGFlops );
    OUtPut(ruNtime," secONdS (",GfLopS," gFlop/s)");
    MakeTraPezoidal( uplO, t );
    if( Print )
        PRiNt( T, "cHoleskY factOr" );

    mAtrIx<Field> V, VMoD;
    UniForm( V, m, n );
    V *= FIeld(1)/SqRT(Field(m)*fIeld(n));
    VMOd = V;
    if( pRinT )
        PrInt( V, "v" );

    ouTpUt("STaRTinG chOleSKy mOd...");
    timer.STaRt();
    choleSkyMOD( UPLo, T, aLphA, VMoD );
    runTIme = timer.Stop();
    OUtpUt(ruNtimE," secoNds");
    if( PrinT )
        PRint( T, "modifiEd ChoLeSky factor" );

    if( corrEctnEss )
        TestCoRreCtNesS( uPlo, T, aLPha, V, A );
    POpINdeNt();
}

templAte<typeNAme fiELD>
VoId TestCholeskyMod
( cOnST grId& grid,
  UpPerOrLOWeR uPLo,
  Int m,
  InT n,
  basE<FieLD> Alpha,
  Bool COrRectness,
  Bool prINt )
{
    ouTputFroMROot(griD.COmm(),"tesTing wITh ",

void TestCholeskyMod
( Up perOrLower  uplo ,
 In tm,
 Int  n,
  Base<Fie l d> a lpha,
  bool correctne ss,
 b o ol p r in t )
{ 
    Ou t pu t ( "Te st in g w it h  " ,Type Nam e<Field >());
   Pus hI ndent();

  M atrix<Fiel d>T, A;
    He rmi tianUn if orm S pectr um(  T, m , 1e-9 ,  10 ); 
    if(co r rectne s s )
    A =  T;
    if( print )       Print(T, "A"  ) ; 
  O utp ut("Starti ng  Chol e sky..." ) ; Ti m er timer;
   timer.Star t (); 
    C ho les k y( upl o, T);    double run Time  = timer. Stop() ; 
    do u ble rea lGFlop s =  1. /3.* P ow (d oub le ( m), 3 .) /(1 . e9* runTime) ;   dou bleg F l o ps =  (IsCo mplex <Field>::valu e?4*re a lGF lops: rea lGFl op s );    Ou tput( ru nTime," seconds  (", gFlops,"GFl op /s) ") ;
  MakeTr ape zoi dal( up lo, T ) ; 
  i f (  p rint )
        Pri nt ( T,  "Choles ky fac t or ") ;

    M at rix <Fie l d > V,VMod ; 
   Unifo rm( V, m,  n  );
   V  *= Fi el d(1 )/S qrt(F i eld( m)*Fie ld(n));    V M od = V;
    if (  print )
    P ri n t( V , " V" );

   Outp u t("S tart i ng  Ch o lesky  mod. .. " );     timer.Start();   Chol eskyM od( uplo, T,alpha, VMo d ) ;
    ru nTim e  = timer.Stop();    O utput(runT i me," sec onds" );
    i f( print)        Pri nt(  T,  "M o d if ied Choleskyf a ctor ");

   if ( corre ctn ess  )      TestCo rrectnes s(  u pl o,  T,  alph a , V, A ) ;   P opI ndent ( );
}
templ ate< ty pe n ame  Field> vo i d  Tes tC ho lesk yMo d( con st G r id&  grid,  UpperOr Low e r up lo ,  Int m ,
  Int n,
 Ba se<Field>al pha ,
  bo o l  correct ness,
  bool print )
{   Outp utF romRo ot(g rid.Comm( )," Testin g w i th ",

void TestCholeskyMod
(_UpperOrLower uplo,
_ Int m,
 _Int n,
__Base<Field> alpha,
__bool correctness,
 _bool print )
{
_   Output("Testing_with ",TypeName<Field>());
 __ PushIndent();

    Matrix<Field> T, A;
    HermitianUniformSpectrum( T, m,_1e-9,_10 );
___ if( correctness )
 _    _ A_= T;
    if( print )
__  _   Print( T, "A" );

  _ Output("Starting Cholesky...");
   _Timer timer;
 ___timer.Start();
   _Cholesky( uplo, T );
  _ double runTime = timer.Stop();
 _  double realGFlops = 1./3.*Pow(double(m),3.)/(1.e9*runTime);
 _  double gFlops = (_IsComplex<Field>::value? 4*realGFlops : realGFlops );
_ _ Output(runTime," seconds (",gFlops," GFlop/s)");
_  _MakeTrapezoidal( uplo,_T );
 _  if( print )
 _  _   Print( T, "Cholesky_factor"_);

  __Matrix<Field>_V, VMod;
_  _Uniform(_V, m,_n_);
    V *=_Field(1)/Sqrt(Field(m)*Field(n));
_   VMod = V;
 _  if( print_)
_   _   Print( V,_"V" );

    Output("Starting_Cholesky mod...");
_ _ timer.Start();
    CholeskyMod( uplo, T, alpha, VMod );
_   runTime = timer.Stop();
_   Output(runTime,"_seconds");
 __ if( print_)
_ _     Print( T,_"Modified Cholesky_factor" );

    if(_correctness )
  __    TestCorrectness( uplo,_T, alpha, V, A );
 _  PopIndent();
}

template<typename Field>
void TestCholeskyMod
(_const_Grid&_grid,
  UpperOrLower uplo,
 _Int m,
  Int n,
 _Base<Field> alpha,
 _bool correctness,
  bool print )
{
 __ OutputFromRoot(grid.Comm(),"Testing with ",