Re: [petsc-users] Product of matrix row times a vector

2020-01-31 Thread Matthew Knepley
On Fri, Jan 31, 2020 at 4:19 AM Jeremy Theler wrote: > > On Thu, 2020-01-30 at 18:05 -0500, Matthew Knepley wrote: > > On Thu, Jan 30, 2020 at 6:04 PM Jeremy Theler > > wrote: > > > On Thu, 2020-01-30 at 21:10 +, Smith, Barry F. wrote: > > > > > > > MatGetSubMatrix() and then do the

Re: [petsc-users] Product of matrix row times a vector

2020-01-31 Thread Jeremy Theler
On Thu, 2020-01-30 at 18:05 -0500, Matthew Knepley wrote: > On Thu, Jan 30, 2020 at 6:04 PM Jeremy Theler > wrote: > > On Thu, 2020-01-30 at 21:10 +, Smith, Barry F. wrote: > > > > > MatGetSubMatrix() and then do the product on the sub matrix > > then > > > VecSum > > > > > > > Ok, I

Re: [petsc-users] Product of matrix row times a vector

2020-01-30 Thread Matthew Knepley
On Thu, Jan 30, 2020 at 6:04 PM Jeremy Theler wrote: > > On Thu, 2020-01-30 at 21:10 +, Smith, Barry F. wrote: > > > MatGetSubMatrix() and then do the product on the sub matrix then > > VecSum > > > > Ok, I have it working in a single-processor and throws the expected > value. Yet I have a

Re: [petsc-users] Product of matrix row times a vector

2020-01-30 Thread Jeremy Theler
On Thu, 2020-01-30 at 21:10 +, Smith, Barry F. wrote: > MatGetSubMatrix() and then do the product on the sub matrix then > VecSum > Ok, I have it working in a single-processor and throws the expected value. Yet I have a segfault in parallel when I ask for the IS corresponding to the

Re: [petsc-users] Product of matrix row times a vector

2020-01-30 Thread Jed Brown
"Smith, Barry F. via petsc-users" writes: > MatGetSubMatrix() and then do the product on the sub matrix then VecSum If you're only doing it once or the relevant rows are changing, it may be cheaper to multiply the whole matrix by a vector instead of creating a submatrix. If you have many of

Re: [petsc-users] Product of matrix row times a vector

2020-01-30 Thread Smith, Barry F. via petsc-users
MatGetSubMatrix() and then do the product on the sub matrix then VecSum Barry > On Jan 30, 2020, at 3:02 PM, Jeremy Theler wrote: > > Sorry if this is basic, but I cannot figure out how to do it in > parallel and I'd rather not say how I do it in single-processor mode > because I would

[petsc-users] Product of matrix row times a vector

2020-01-30 Thread Jeremy Theler
Sorry if this is basic, but I cannot figure out how to do it in parallel and I'd rather not say how I do it in single-processor mode because I would be ashamed. Say I have a matrix and I want to multiply a row times a vector to obtain a scalar. Actually I would like to choose some rows, multiply