GTestSuite fix on trsm tests.

- Fixing thresholds to be more appropriate.
- Updating the way random entries of A and B are generated so that A is diagonally dominant and the algorithm doesn't diverge.

AMD-Internal: [CPUPL-2732]
Change-Id: I6d5691d744ecc623f66c45e94461bd88625d7179
This commit is contained in:
Eleni Vlachopoulou
2023-04-11 20:01:21 +05:30
parent be7fb342c1
commit e8392fedb8
5 changed files with 16 additions and 8 deletions

View File

@@ -80,7 +80,7 @@ TEST_P(ctrsmTest, RandomData) {
char datatype = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 15*n*m*testinghelpers::getEpsilon<T>();
double thresh = std::max(m, n)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
@@ -139,8 +139,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values('u','l'), // uplo u:upper, l:lower
::testing::Values('n','c','t'), // transa
::testing::Values('n','u'), // diaga , n=nonunit u=unit
::testing::Range(gtint_t(10), gtint_t(11), 10), // m
::testing::Range(gtint_t(10), gtint_t(11), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Values(scomplex{2.0,-1.0}), // alpha
::testing::Values(gtint_t(0), gtint_t(3)), // increment to the leading dim of a
::testing::Values(gtint_t(0), gtint_t(4)), // increment to the leading dim of b

View File

@@ -80,7 +80,7 @@ TEST_P(dtrsmTest, RandomData) {
char datatype = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 20*n*m*testinghelpers::getEpsilon<T>();
double thresh = std::max(m, n)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -80,7 +80,7 @@ TEST_P(strsmTest, RandomData) {
char datatype = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 15*n*m*testinghelpers::getEpsilon<T>();
double thresh = std::max(m, n)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -54,9 +54,17 @@ void test_trsm( char storage, char side, char uploa, char transa,
//----------------------------------------------------------
// Initialize matrics with random values.
//----------------------------------------------------------
std::vector<T> a = testinghelpers::get_random_matrix<T>(2, 18, storage, transa, mn, mn, lda, datatype);
std::vector<T> b = testinghelpers::get_random_matrix<T>(5, 12, storage, 'n', m, n, ldb, datatype);
gtint_t lower = (diaga = 'n')||(diaga = 'N') ? 3 : 0;
gtint_t upper = (diaga = 'n')||(diaga = 'N') ? 10 : 1;
std::vector<T> a = testinghelpers::get_random_matrix<T>(lower, upper, storage, transa, mn, mn, lda, datatype);
std::vector<T> b = testinghelpers::get_random_matrix<T>(3, 10, storage, 'n', m, n, ldb, datatype);
// Making A diagonally dominant so that the condition number is good and
// the algorithm doesn't diverge.
for (gtint_t i=0; i<mn; i++)
{
a[i+i*lda] = T{float(mn)}*a[i+i*lda];
}
// Create a copy of v so that we can check reference results.
std::vector<T> b_ref(b);

View File

@@ -80,7 +80,7 @@ TEST_P(ztrsmTest, RandomData) {
char datatype = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 15*n*m*testinghelpers::getEpsilon<T>();
double thresh = std::max(m, n)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters