Skip to content

Commit

Permalink
Fix rocsparse spitsv example residual check (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
MKKnorr authored Nov 21, 2024
1 parent 14f07b9 commit 62b67a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Libraries/rocSPARSE/level_2/spitsv/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ int main()
constexpr double tolerance = 1e-4;

// Set up convergence history.
std::array<double, max_iter> residual_history;
std::array<double, max_iter> residual_history{};

// 4. Prepare device for rocSPARSE iterative SpSV invocation.
// Obtain required buffer size in bytes for analysis and solve stages.
Expand Down Expand Up @@ -211,7 +211,7 @@ int main()
std::cout << "Iterations performed: " << iter_counter << std::endl;

// Check last residual computed to confirm that convergence was successful.
const double last_residual = residual_history.back();
const double last_residual = residual_history[iter_counter];
const bool is_converged = last_residual < tolerance;

int errors{};
Expand Down

0 comments on commit 62b67a2

Please sign in to comment.