[petsc-dev] [petsc-maint] Complementarity problems: vinewton?sls or tao_?s?ls
Barry Smith
bsmith at mcs.anl.gov
Tue Mar 17 11:32:54 CDT 2015
Lisandro,
Could you please point me to or send me an example that sets a Matrix operation "after the fact" on a matrix using PETSc4py I want to understand the issue.
Thanks
Barry
> On Mar 10, 2015, at 4:06 AM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>
> CC-ing petsc-dev
>
> On 10 March 2015 at 03:08, Patrick Farrell
> <patrick.farrell at maths.ox.ac.uk> wrote:
>> I personally think that if the user hasn't supplied a getSubMatrix method in
>> Python, that the Mat shouldn't have a mat->ops->getsubmatrix --- but maybe
>> that
>> isn't feasible or easy.
>>
>> Lisandro, what do you think?
>
> Well, the thing is that Python is a dynamic language, so I designed
> things to let users add methods even after the matrix was created.
> This definitely plays bad with the way MatHasOperation() is
> implemented.
>
> If we remove that feature (I would not really care too much), then we
> could defer the filling of most mat->ops pointers up to the point
> MatSetUp() is called. What do you think? And BTW, perhaps we should
> follow the same approach in the other Python subtypes (KSP, SNES, TS,
> etc).
>
> Or, we could change MatHasOperation() to have a slot in mat->ops, i.e.
> if mat-ops->hasoperation is available, we delegate the call to the
> subtype. This approach requires more coding in the PETSc side, some
> careful check of places where mat->ops->xxx is accessed where
> MatHasOperation() should be used instead, and some minor extra code in
> petsc4py (basically, a dict operation:methodname and a hasattr check).
>
>
> --
> Lisandro Dalcin
> ============
> Research Scientist
> Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
> Numerical Porous Media Center (NumPor)
> King Abdullah University of Science and Technology (KAUST)
> http://numpor.kaust.edu.sa/
>
> 4700 King Abdullah University of Science and Technology
> al-Khawarizmi Bldg (Bldg 1), Office # 4332
> Thuwal 23955-6900, Kingdom of Saudi Arabia
> http://www.kaust.edu.sa
>
> Office Phone: +966 12 808-0459
More information about the petsc-dev
mailing list