Re: [petsc-users] MatCopy question

2024-09-26 Thread Junchao Zhang
Is it possible to set the size of the COMPACT matrix as large as the WIDE matrix, then do MatAYPX(WIDE, 0, COMPACT, SUBSET_NONZERO_PATTERN), i.e, WIDE = 0*WIDE + COMPACT? You need to build WIDE upfront once, but if you repeat, the other MatAYPX will be fast. --Junchao Zhang On Thu, Sep 26, 2024

Re: [petsc-users] MatCopy question

2024-09-26 Thread Junchao Zhang
No, Setting a bigger matrix size won't have a negative impact. Only the actual number of nonzeros matters. --Junchao Zhang On Thu, Sep 26, 2024 at 1:33 PM Frank Bramkamp wrote: > Thanks for the reply, > > when setting the size larger than needed, would that have any negative > impact somewher

Re: [petsc-users] MatCopy question

2024-09-26 Thread Barry Smith
Frank, Sorry for the confusion. MatCopy() and MatAXPY() only work for identically sized matrices. Even if the two matrices are the same size but one, say A, has a subset of nonzeros than the other, say B, what you want to do is non-trivial. This is because to do a copy you must MatAs