28 #include <tests/myratest.h>    35 template<
class Precision> 
void test(
int I, 
int J, Precision tolerance)
    37   typedef std::complex<Precision> Number;
    38   myra::out() << typestring<Number>() << std::endl;
    42   Number alpha = random<Number>();
    43   Precision beta = random<Precision>();
    45   auto options = Options::create().set_nthreads(4).set_blocksize(128);
    49     for (
int i = 0; i < I; ++i)
    50       C_serial(i,i) = std::real(C_serial(i,i));
    51     auto C_parallel = C_serial;
    52     her2k_inplace(C_serial,A,B,
'N',alpha,beta);
    53     pher2k_inplace(C_parallel,A,B,
'N',alpha,beta,options);
    54     Precision error = frobenius(C_serial-C_parallel) / frobenius(C_serial);
    55     myra::out() << 
"  |her2k('N')-pher2k('N')| = " << error << std::endl;
    56     REQUIRE(error < tolerance);
    61     for (
int j = 0; j < J; ++j)
    62       C_serial(j,j) = std::real(C_serial(j,j));
    63     auto C_parallel = C_serial;
    64     her2k_inplace(C_serial,A,B,
'T',alpha,beta);
    65     pher2k_inplace(C_parallel,A,B,
'T',alpha,beta,options);
    66     Precision error = frobenius(C_serial-C_parallel) / frobenius(C_serial);
    67     myra::out() << 
"  |her2k('T')-pher2k('T')| = " << error << std::endl;
    68     REQUIRE(error < tolerance);
    73     for (
int j = 0; j < J; ++j)
    74       C_serial(j,j) = std::real(C_serial(j,j));
    75     auto C_parallel = C_serial;
    76     her2k_inplace(C_serial,A,B,
'H',alpha,beta);
    77     pher2k_inplace(C_parallel,A,B,
'H',alpha,beta,options);
    78     Precision error = frobenius(C_serial-C_parallel) / frobenius(C_serial);
    79     myra::out() << 
"  |her2k('H')-pher2k('H')| = " << error << std::endl;
    80     REQUIRE(error < tolerance);
    85     for (
int i = 0; i < I; ++i)
    86       C_serial(i,i) = std::real(C_serial(i,i));
    87     auto C_parallel = C_serial;
    88     her2k_inplace(C_serial,A,B,
'C',alpha,beta);
    89     pher2k_inplace(C_parallel,A,B,
'C',alpha,beta,options);
    90     Precision error = frobenius(C_serial-C_parallel) / frobenius(C_serial);
    91     myra::out() << 
"  |her2k('C')-pher2k('C')| = " << error << std::endl;
    92     REQUIRE(error < tolerance);
    98 ADD_TEST(
"pher2k2",
"[pdense][parallel]")
   102   test<float > (I,J,1.0e-4f);
   103   test<double> (I,J,1.0e-8);
 Thread parallel version of dense/her2k.h, hermitian rank-2k updates. 
Interface class for representing subranges of dense Matrix's. 
Routines for computing Frobenius norms of various algebraic containers. 
static Matrix< Number > random(int I, int J)
Generates a random Matrix of specified size. 
Definition: Matrix.cpp:353
Options pack for routines in /pdense. 
Definition: Options.h:24
Routines for hermitian rank-2k updates, a specialized form of Matrix*Matrix multiplication. 
Range construct for a lower triangular matrix stored in rectangular packed format. 
Specialized container for a lower triangular matrix, O(N^2/2) storage. Used by symmetry exploiting ma...
Various utility functions/classes related to scalar Number types. 
General purpose dense matrix container, O(i*j) storage. 
Options pack for routines in /pdense. 
Simplistic random number functions. 
static LowerMatrix< Number > random(int N)
Generates a random LowerMatrix of specified size. 
Definition: LowerMatrix.cpp:249
std::complex<float>
  |her2k('N')-pher2k('N')| = 3.75736e-08
  |her2k('T')-pher2k('T')| = 5.82294e-08
  |her2k('H')-pher2k('H')| = 5.82239e-08
  |her2k('C')-pher2k('C')| = 3.81043e-08
std::complex<double>
  |her2k('N')-pher2k('N')| = 1.15687e-16
  |her2k('T')-pher2k('T')| = 1.42385e-16
  |her2k('H')-pher2k('H')| = 1.4353e-16
  |her2k('C')-pher2k('C')| = 1.15855e-16