28 #include <tests/myratest.h>    34 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   Precision alpha = random<Precision>();
    43   Precision beta = random<Precision>();
    48     for (
int i = 0; i < I; ++i)
    49       C1(i,i) = std::real(C1(i,i));
    51     gemm_inplace(C1,A,
'N',A,
'H',Number(alpha),Number(beta));
    52     herk_inplace(C2,
'U',A,
'N',alpha,beta);
    53     Precision error = frobenius(triu(C1-C2));
    54     myra::out() << 
" |herk('N')-gemm('N','H')| = " << error << std::endl;
    55     REQUIRE(error < tolerance);
    61     for (
int j = 0; j < J; ++j)
    62       C1(j,j) = std::real(C1(j,j));
    64     gemm_inplace(C1,A,
'T',A,
'C',Number(alpha),Number(beta));
    65     herk_inplace(C2,
'U',A,
'T',alpha,beta);
    66     Precision error = frobenius(triu(C1-C2));
    67     myra::out() << 
" |herk('T')-gemm('T','C')| = " << error << std::endl;
    68     REQUIRE(error < tolerance);
    74     for (
int j = 0; j < J; ++j)
    75       C1(j,j) = std::real(C1(j,j));
    77     gemm_inplace(C1,A,
'H',A,
'N',Number(alpha),Number(beta));
    78     herk_inplace(C2,
'U',A,
'H',alpha,beta);
    79     Precision error = frobenius(triu(C1-C2));
    80     myra::out() << 
" |herk('H')-gemm('H','N')| = " << error << std::endl;
    81     REQUIRE(error < tolerance);
    87     for (
int i = 0; i < I; ++i)
    88       C1(i,i) = std::real(C1(i,i));
    90     gemm_inplace(C1,A,
'C',A,
'T',Number(alpha),Number(beta)); 
    91     herk_inplace(C2,
'U',A,
'C',alpha,beta);
    92     Precision error = frobenius(triu(C1-C2));
    93     myra::out() << 
" |herk('C')-gemm('C','T')| = " << error << std::endl;
    94     REQUIRE(error < tolerance);
   101 ADD_TEST(
"cherkU",
"[dense][blas]")
   102   { test<float>(54,37,1.0e-4f); }
   104 ADD_TEST(
"zherkU",
"[dense][blas]")
   105   { test<double>(54,37,1.0e-8); }
 Returns a conjugated copy of a Matrix or Vector. Or, conjugate one inplace. 
Tabulates an IxJ matrix. Allows random access, has column major layout to be compatible with BLAS/LAP...
Definition: bdsqr.h:20
Routines for hermitian rank-k updates, a specialized form of Matrix*Matrix multiplication. 
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
Replaces small values with explicit zeros. 
Returns a transposed copy of a Matrix. The inplace version only works on a square operand...
Returns the lower triangle of a dense Matrix. 
Returns the upper triangle of a dense Matrix. 
Various utility functions/classes related to scalar Number types. 
General purpose dense matrix container, O(i*j) storage. 
Returns a hermitian copy of a Matrix. The inplace version only works on a square operand. 
Simplistic random number functions. 
Variety of routines all for dense Matrix*Matrix multiplies. Delegates to the BLAS. 
std::complex<float>
 |herk('N')-gemm('N','H')| = 5.83482e-07
 |herk('T')-gemm('T','C')| = 5.3e-07
 |herk('H')-gemm('H','N')| = 5.3e-07
 |herk('C')-gemm('C','T')| = 5.83482e-07