Re: [petsc-users] How to efficiently fill in, in parallel, a PETSc matrix from a COO sparse matrix?

2023-06-21 Thread Diego Magela Lemos via petsc-users
Please, could you provide a minimal working example (or link) of how to do this? Thank you. Em ter., 20 de jun. de 2023 às 15:08, Matthew Knepley escreveu: > On Tue, Jun 20, 2023 at 2:02 PM Diego Magela Lemos > wrote: > >> So... what do I need to do, please? >> Why am I getting wrong results

Re: [petsc-users] How to efficiently fill in, in parallel, a PETSc matrix from a COO sparse matrix?

2023-06-20 Thread Diego Magela Lemos via petsc-users
So... what do I need to do, please? Why am I getting wrong results when solving the linear system if the matrix is filled in with MatSetPreallocationCOO and MatSetValuesCOO? Em ter., 20 de jun. de 2023 às 14:56, Jed Brown escreveu: > Matthew Knepley writes: > > >> The matrix entries are

Re: [petsc-users] How to efficiently fill in, in parallel, a PETSc matrix from a COO sparse matrix?

2023-06-20 Thread Diego Magela Lemos via petsc-users
un. de 2023 às 13:13, Barry Smith escreveu: > > Since you have 6 entries that needed to be added to the matrix you will > need to call MatSetValues() six time for the six entries. > > On Jun 20, 2023, at 11:06 AM, Matthew Knepley wrote: > > On Tue, Jun 20, 2023 at 10:55 AM

[petsc-users] How to efficiently fill in, in parallel, a PETSc matrix from a COO sparse matrix?

2023-06-20 Thread Diego Magela Lemos via petsc-users
Considering, for instance, the following COO sparse matrix format, with repeated indices: std::vector rows{0, 0, 1, 2, 3, 4}; std::vector cols{0, 0, 1, 2, 3, 4}; std::vector values{2, -1, 2, 3, 4, 5}; that represents a 5x5 diagonal matrix A. So far, the code that I have is: //