Re: [petsc-users] a question about MatSetValue

2020-05-21 Thread Yang Bo (Asst Prof)
I see, it is working now, thanks! On 21 May 2020, at 6:23 PM, Dave May mailto:dave.mayhe...@gmail.com>> wrote: On Thu 21. May 2020 at 12:17, Yang Bo (Asst Prof) mailto:yang...@ntu.edu.sg>> wrote: Hi Dave, Yes it is parallel so the preallocation calls are not lowered by the allocation. I am

Re: [petsc-users] a question about MatSetValue

2020-05-21 Thread Dave May
On Thu 21. May 2020 at 12:17, Yang Bo (Asst Prof) wrote: > Hi Dave, > > Yes it is parallel so the preallocation calls are not lowered by the > allocation. > > I am trying to use MatXAIJSetPreallocation, but not sure how, since the > following link does not give an example: > > >

Re: [petsc-users] a question about MatSetValue

2020-05-21 Thread Yang Bo (Asst Prof)
Hi Dave, Yes it is parallel so the preallocation calls are not lowered by the allocation. I am trying to use MatXAIJSetPreallocation, but not sure how, since the following link does not give an example:

Re: [petsc-users] a question about MatSetValue

2020-05-21 Thread Dave May
On Thu 21. May 2020 at 10:49, Yang Bo (Asst Prof) wrote: > Hi Dave, > > Thank you very much for your reply. That is indeed the problem. I have > been working with matrices in Slepc but I don’t really understand it. I > tried to preallocate but it still does not work. > Meaning the number of

Re: [petsc-users] a question about MatSetValue

2020-05-21 Thread Yang Bo (Asst Prof)
Hi Dave, Thank you very much for your reply. That is indeed the problem. I have been working with matrices in Slepc but I don’t really understand it. I tried to preallocate but it still does not work. If you look at my code below: ierr = MatCreate(PETSC_COMM_WORLD,);CHKERRQ(ierr); ierr =

Re: [petsc-users] a question about MatSetValue

2020-05-21 Thread Dave May
On Thu, 21 May 2020 at 08:55, Yang Bo (Asst Prof) wrote: > Hi Everyone, > > I have a question about adding values to the matrix. The code I have is > > > for (int i=0;i MatSetValue(A,row[i],column[i],h[i],INSERT_VALUES); > } > > where row.size() is a large number. It seems the running time of

[petsc-users] a question about MatSetValue

2020-05-21 Thread Yang Bo (Asst Prof)
Hi Everyone, I have a question about adding values to the matrix. The code I have is for (int i=0;i