Skip to content

How to convert TrilinosWrappers::SparseMatrix and dealii::LinearAlgebra::distributed::Vector for Ginkgo #1508

Answered by MarcelKoch
acse-bn20 asked this question in Q&A
Discussion options

You must be logged in to vote

If I understand you correctly, you want to do a single copy instead of looping through the matrix to fill the Ginkgo types. This is very much possible, but it depends on how you can get access to the underlying pointers to the trillinos or dealii data. Assuming you can get the pointers here is what you can do:

// the type of the pointer can be changed, depending on what trillinos stores
int* trillinos_row_ptrs = ...;  // the pointer to the trillinos row pointers/offsets
int* trillinos_col_idxs = ...;  // the pointer to the trillinos column indices
double* trillinos_values = ...;  // the pointer to the trillinos CSR values

// creating Ginkgo arrays and copy assign views of the trillinos data

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by upsj
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1499 on December 13, 2023 12:28.