Skip to content

Conversation

@quantumsteve
Copy link
Collaborator

Description

Please describe the issue that is addressed (bug, new feature,
documentation, enhancement, etc.). Please also include relevant motivation and
context. List any dependencies that are required for this change.

This is part of #393.

Proposed changes

Describe how your changes here address the issue and why the proposed changes
should be accepted.

This adds a new member function MatrixHandler::scaleAddI to compute A := c*A+I. The sparsity pattern (row pointers and column indices) are stored in LinAlgWorkspaceCpu and reused by future calculations. One must check if the diagonal element is already nonzero and add 1 or add a new nonzero element to the matrix.

The test verifies that the sum of rows is 1 larger than the sum of the original row scaled by c.

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask. We're here
to help! This is simply a reminder of what we are going to look for before
merging your code.

  • All tests pass. Code tested on
    • CPU backend
    • CUDA backend
    • HIP backend
  • Code compiles cleanly with flags -Wall -Wpedantic -Wconversion -Wextra.
  • The new code follows Re::Solve style guidelines.
  • There are unit tests for the new code.
  • The new code is documented.
  • The feature branch is rebased with respect to the target branch.
  • I have updated CHANGELOG.md to reflect the changes in this PR. If this is a minor PR that is part of a larger fix already included in the file, state so.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining
why you chose the solution you did and what alternatives you considered, etc.

Doesn't yet reuse sparsity pattern.
Signed-off-by: Steven Hahn <[email protected]>
Signed-off-by: Steven Hahn <[email protected]>
Signed-off-by: Steven Hahn <[email protected]>
Signed-off-by: Steven Hahn <[email protected]>
Signed-off-by: Steven Hahn <[email protected]>
Signed-off-by: Steven Hahn <[email protected]>
Signed-off-by: Steven Hahn <[email protected]>
Signed-off-by: Steven Hahn <[email protected]>
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.

1 participant