Skip to content

how to transfer an initial field before solve ax=b #1135

Answered by pratikvn
ztdepztdep asked this question in Q&A
Discussion options

You must be logged in to vote

Do you mean the initial solution, x ? If you have a pointer (say dx) to the data on exec which can be either ReferenceExecutor or CudaExecutor, then you can just do:
(Updated):

auto x = gko::matrix::Dense<ValueType>::create(exec, 
                                               gko::dim<2>(num_elems, 1), 
                                               gko::array<ValueType>::view(exec, num_elems, dx),
                                               stride);

This will not allocate new memory, but use the data that dx points to and which is of size num_elems

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ztdepztdep
Comment options

@upsj
Comment options

upsj Oct 26, 2022
Maintainer

Answer selected by pratikvn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
is:question This is a question to the developers.
3 participants