[petsc-dev] PetscObjectStateIncrease in MatMult*

Václav Hapla vaclav.hapla at vsb.cz
Mon Oct 19 05:00:48 CDT 2015


I wonder in which situation it would be desirable not to change the 
state while the vector actually changed its values.
But maybe I do not fully understand the meaning of PetscObjectState.
I see the only legitimate case of not changing PetscObjectState if one 
has an identity mapping.
But maybe in this (rather uncommon) situation one could decrease the 
state back, taking responsibility for that...
Vaclav

Dne 17.10.2015 v 18:18 Matthew Knepley napsal(a):
> On Sat, Oct 17, 2015 at 11:12 AM, Václav Hapla <vaclav.hapla at vsb.cz 
> <mailto:vaclav.hapla at vsb.cz>> wrote:
>
>     Yes, exactly, MATSHELL.
>     But if I am right, MatShellSetOperation sets mat->ops->mult
>     pointer directly to user-specified MatMult unless
>     MatShellUseScaledMethods has been called.
>     So user must keep in mind he should call PetscObjectStateIncrease
>     in his MatMult.
>     I feel like this is something one would intuitively await from the
>     interface function...
>     It would be less error-prone for future and user-implemented MatTypes.
>
>
> That removes the ability to leave the vector unchanged by an implementor.
>
>    Matt
>
>     Vaclav
>
>     Dne 17.10.2015 v 17:58 Barry Smith napsal(a):
>
>             On Oct 17, 2015, at 5:10 AM, Václav Hapla
>             <vaclav.hapla at vsb.cz <mailto:vaclav.hapla at vsb.cz>> wrote:
>
>             Hello,
>             MatMult(), MatMultTranspose(), MatMultAdd(),
>             MatMultTransposeAdd() and PCApply() belong to most common
>             modifiers of Vec values.
>             Maybe it would be nice if these routines called
>             PetscObjectStateIncrease explicitly because of MATSHELL
>             and such stuff.
>             Thanks,
>             Vaclav
>
>             I assume you are suggesting this because users of MATSHELL
>         or PCSHELL may not realize they need to call
>         PetscObjectStateIncrease() on the output vector if they do not
>         use VecGe/RestoretArray() to access the vector entries?
>         (VecRestoreArray() automatically increases the state)
>
>             What if we add it to MatMult_Shell(),
>         MatMultTranspose_Shell(), PCApply_Shell() and
>         PCApplyTranspose_Shell()?  It looks like those are the only
>         ones where the state won't get increased automatically
>
>             Thanks for the suggestion,
>
>            Barry
>
>             -- 
>
>             Vaclav Hapla
>             Junior researcher
>             IT4Innovations <http://www.it4i.eu/>
>
>
>
>     -- 
>
>     Vaclav Hapla
>     Junior researcher
>     IT4Innovations <http://www.it4i.eu/>
>
>     *office*
>     phone: (+420) 597 32 9662 <tel:%28%2B420%29%20597%2032%209662>
>     room 310
>     IT4Innovations building
>     Studentska 6231/1B
>     708 00 Ostrava - Poruba
>     Czech Republic
>
>     *contact address*
>     Vaclav Hapla
>     IT4Innovations
>     VSB - Technical University of Ostrava
>     17. listopadu 15/2172
>     708 33 Ostrava - Poruba
>     Czech Republic
>
>
>
>
>
> -- 
> What most experimenters take for granted before they begin their 
> experiments is infinitely more interesting than any results to which 
> their experiments lead.
> -- Norbert Wiener

-- 

Vaclav Hapla
Junior researcher
IT4Innovations <http://www.it4i.eu/>

*office*
phone: (+420) 597 32 9662
room 310
IT4Innovations building
Studentska 6231/1B
708 00 Ostrava - Poruba
Czech Republic

*contact address*
Vaclav Hapla
IT4Innovations
VSB - Technical University of Ostrava
17. listopadu 15/2172
708 33 Ostrava - Poruba
Czech Republic


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3290 bytes
Desc: Elektronicky podpis S/MIME
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20151019/13b7b9c6/attachment-0001.p7s>


More information about the petsc-dev mailing list