Re: [petsc-users] Question Regarding Duplicate Indices in VecSetValues().

2025-01-14 Thread Junchao Zhang
Add Matt mentioned, with ADD_VALUES, the values will be added. But with INSERT_VALUES, if it is a sequential vector (VECSEQ), it will overwrite with the last value; but if it is an MPI parallel vector (VECMPI), it is undetermined, as you could not even define "which is the last" (assuming duplic

Re: [petsc-users] Question Regarding Duplicate Indices in VecSetValues().

2025-01-14 Thread Matthew Knepley
On Tue, Jan 14, 2025 at 9:06 AM Mark Adams wrote: > INSERT_VALUES is clearly an error, but we can't check that easily so you > will probably just get the last value, and ADD_VALUES should work. > For INSERT_VALUES, it will overwrite with the last value. For ADD_VALUES, it will add. Thanks,

Re: [petsc-users] Question Regarding Duplicate Indices in VecSetValues().

2025-01-14 Thread Mark Adams
INSERT_VALUES is clearly an error, but we can't check that easily so you will probably just get the last value, and ADD_VALUES should work. Mark On Tue, Jan 14, 2025 at 8:20 AM Venkata Narayana Sarma Dhavala < dhav...@udel.edu> wrote: > Dear PETSc Development Team, > > I hope this message finds

[petsc-users] Question Regarding Duplicate Indices in VecSetValues().

2025-01-14 Thread Venkata Narayana Sarma Dhavala
Dear PETSc Development Team, I hope this message finds you well. I am currently working with the VecSetValues() function in PETSc, and I have a question regarding its behavior when there are duplicate indices in the input array. PetscErrorCode VecSetValues(Vec x, PetscInt ni, const PetscInt ix[],