Re: [petsc-users] Incoherent data entries in array from a dense sub matrix

2025-02-08 Thread medane.tchako...@univ-fcomte.fr
Dear petsc team, Thank you for all your answers. I really appreciate. Best regards, Medane > On 7 Feb 2025, at 15:22, Matthew Knepley wrote: > > On Fri, Feb 7, 2025 at 8:20 AM medane.tchako...@univ-fcomte.fr >

Re: [petsc-users] Incoherent data entries in array from a dense sub matrix

2025-02-07 Thread Matthew Knepley
On Fri, Feb 7, 2025 at 8:20 AM medane.tchako...@univ-fcomte.fr < medane.tchako...@univ-fcomte.fr> wrote: > Re: > Please find below the output from the previous code, running on only one > processor. > > Mat Object: 1 MPI process > type: seqdense > 7.2003197397953400e-01 3.980919128602e-01 9.

Re: [petsc-users] Incoherent data entries in array from a dense sub matrix

2025-02-07 Thread medane.tchako...@univ-fcomte.fr
Re: Please find below the output from the previous code, running on only one processor. Mat Object: 1 MPI process type: seqdense 7.2003197397953400e-01 3.980919128602e-01 9.8405227390177075e-01 1.4405427480322786e-01 6.1793966542126100e-02 7.3036588248200474e-02 7.3851607000756303e-01 9.9

Re: [petsc-users] Incoherent data entries in array from a dense sub matrix

2025-02-07 Thread Jose E. Roman via petsc-users
This is expected. For dense matrices, MatDenseGetSubMatrix() does not duplicate the memory. You should interpret the array as a two-dimensional column-major array: buffer[i+j*lda] where i,j are row and column indices, and lda can be obtained with MatDenseGetLDA(). Jose > El 7 feb 2025, a las 1

Re: [petsc-users] Incoherent data entries in array from a dense sub matrix

2025-02-07 Thread Pierre Jolivet
> On 7 Feb 2025, at 11:05 AM, medane.tchako...@univ-fcomte.fr wrote: > > > Dear all, > > I have been experiencing incoherent data entries from this code below, when > printing the array. Maybe I’am doing something wrong. What is incoherent? Everything looks OK to me. Thanks, Pierre >

[petsc-users] Incoherent data entries in array from a dense sub matrix

2025-02-07 Thread medane.tchako...@univ-fcomte.fr
Dear all, I have been experiencing incoherent data entries from this code below, when printing the array. Maybe I’am doing something wrong. PetscInt nlines = 8; // lines PetscInt ncols = 4; // columns PetscMPIInt rank; PetscMPIInt size; // Initialize P