Skip to content

Conversation

@Mahmood-Sinan
Copy link

Summary:
This pr fixes two issues within tridiagonal_matrices module.

  1. Inside the impure functions for initializing tridiagonal_matrices, the matrix fields were assigned even if there was an error(for example, when the sizes of du and dl vectors differed from dv by more than one).
  2. Inside spmv subroutine, the y vector was forcefully being zeroed instead of using the passed argument.

Changes:

  1. Added an if (err0%ok()) check in the impure initialization functions.
  2. Removed the unintended y = 0.0_${k1}$ in the spmv subroutine.

@loiseaujc
Copy link
Contributor

Thanks for spotting some things I completely missed. Could you also extend the tests to ensure that the cases with $(\alpha, \beta) \neq (1, 0)$ work correctly.

@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@21c65ab). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1054   +/-   ##
=========================================
  Coverage          ?   25.13%           
=========================================
  Files             ?      570           
  Lines             ?   234201           
  Branches          ?    41267           
=========================================
  Hits              ?    58858           
  Misses            ?   175343           
  Partials          ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@loiseaujc
Copy link
Contributor

As it is, we do not perform any check in spmv to ensure $(\alpha, \beta) \in (-1, 0, 1)^2$ nor that op = N, T or C. I was wondering whether we should include such checks to dumb-proof the implementation, in particular the $(\alpha, \beta)$ one since this is a quirk from the lapack implementation of *LAGTM differing from *GEMM.

@perazz, @jvdp1 and @jalvesz : What do you think? Should we modify the interface to be something like

subroutine spmv(A, x, y, alpha, beta, op, err)

where err is a linalg_state_type and have the subroutine potentially raise an error if the alpha, beta or op provided by the user are not admissible? Note that *GEMM does not have an info return flag. I'm not entirely sure what it does if transa or transb are not admissible, neither does *LAGTM. Also, the spmv kernels by @jalvesz for sparse matrices do not ensure that op is admissible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants