29 #include <tests/myratest.h> 36 template<
class Precision>
void test(
int I,
int J, Precision tolerance)
38 typedef std::complex<Precision> Number;
39 myra::out() << typestring<Number>() << std::endl;
42 Precision alpha = random<Precision>();
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 herk_inplace(C_serial,A,
'N',alpha,beta);
53 pherk_inplace(C_parallel,A,
'N',alpha,beta,options);
54 Precision error = frobenius(C_serial-C_parallel) / frobenius(C_serial);
55 myra::out() <<
" |herk('N')-pherk('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 herk_inplace(C_serial,A,
'T',alpha,beta);
65 pherk_inplace(C_parallel,A,
'T',alpha,beta,options);
66 Precision error = frobenius(C_serial-C_parallel) / frobenius(C_serial);
67 myra::out() <<
" |herk('T')-pherk('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 herk_inplace(C_serial,A,
'H',alpha,beta);
77 pherk_inplace(C_parallel,A,
'H',alpha,beta,options);
78 Precision error = frobenius(C_serial-C_parallel) / frobenius(C_serial);
79 myra::out() <<
" |herk('H')-pherk('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 herk_inplace(C_serial,A,
'C',alpha,beta);
89 pherk_inplace(C_parallel,A,
'C',alpha,beta,options);
90 Precision error = frobenius(C_serial-C_parallel) / frobenius(C_serial);
91 myra::out() <<
" |herk('C')-pherk('C')| = " << error << std::endl;
92 REQUIRE(error < tolerance);
98 ADD_TEST(
"pherk2",
"[pdense][parallel]")
102 test<float > (I,J,1.0e-4f);
103 test<double> (I,J,1.0e-8);
Interface class for representing subranges of dense Matrix's.
Routines for hermitian rank-k updates, a specialized form of Matrix*Matrix multiplication.
Routines for computing Frobenius norms of various algebraic containers.
Thread parallel version of dense/herk.h, hermitian rank-k updates.
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
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.
Returns a hermitian copy of a Matrix. The inplace version only works on a square operand.
Simplistic random number functions.
static LowerMatrix< Number > random(int N)
Generates a random LowerMatrix of specified size.
Definition: LowerMatrix.cpp:249
std::complex<float>
|herk('N')-pherk('N')| = 0
|herk('T')-pherk('T')| = 0
|herk('H')-pherk('H')| = 0
|herk('C')-pherk('C')| = 0
std::complex<double>
|herk('N')-pherk('N')| = 0
|herk('T')-pherk('T')| = 0
|herk('H')-pherk('H')| = 0
|herk('C')-pherk('C')| = 0