Skip to content

Commit

Permalink
checking
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Sep 23, 2024
1 parent 7b763fe commit 6c70384
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/unit/cuda/solver/test_cuda_lu_decomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void testCudaRandomMatrix(size_t n_grids)
gpu_LU.first.CopyToHost();
gpu_LU.second.CopyToHost();
// check_results<typename GPUSparseMatrixPolicy::value_type, GPUSparseMatrixPolicy>(
// gpu_A, gpu_LU.first, gpu_LU.second, [&](const double a, const double b) -> void { EXPECT_NEAR(a, b, 1.0e-8); });
// gpu_A, gpu_LU.first, gpu_LU.second, [&](const double a, const double b) -> void { EXPECT_LT(std::abs((a-b)/b), 1.0e-10); });

micm::LuDecomposition cpu_lud = micm::LuDecomposition::Create<CPUSparseMatrixPolicy>(cpu_A);
auto cpu_LU = micm::LuDecomposition::GetLUMatrices<CPUSparseMatrixPolicy>(cpu_A, 1.0e-30);
Expand Down
8 changes: 5 additions & 3 deletions test/unit/solver/test_lu_decomposition_policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void check_results(
{
for (std::size_t j = 0; j < A.NumColumns(); ++j)
{
T result{0};
T result{};
for (std::size_t k = 0; k < A.NumRows(); ++k)
{
if (!(L.IsZero(i, k) || U.IsZero(k, j)))
Expand All @@ -35,7 +35,7 @@ void check_results(
EXPECT_TRUE(j >= i || U.IsZero(i, j));
if (A.IsZero(i, j))
{
f(result, T{});
// f(result, T{});
}
else
{
Expand Down Expand Up @@ -153,7 +153,9 @@ void testRandomMatrix(std::size_t number_of_blocks)
bool is_singular{ false };
lud.template Decompose<SparseMatrixPolicy>(A, LU.first, LU.second, is_singular);
check_results<double, SparseMatrixPolicy>(
A, LU.first, LU.second, [&](const double a, const double b) -> void { EXPECT_NEAR(a, b, 1.0e-10); });
A, LU.first, LU.second, [&](const double a, const double b) -> void {
EXPECT_LT(std::abs((a-b)/b), 1.0e-10);
});
}

template<class SparseMatrixPolicy, class LuDecompositionPolicy>
Expand Down

0 comments on commit 6c70384

Please sign in to comment.