<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Menlo;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link=blue vlink=purple style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Dear Barry,<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>thanks for the clarification. Oh, that’s unfortunate, that not all TAO algorithms use the supplied matrix for the norm (and then probably also not for computing inner products in, e.g., the limited memory formulas).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>I fear that I don’t have sufficient time at the moment to make a MR. I could, however, provide some “minimal” example where the behavior is shown. However, that example would be using petsc4py as I am only familiar with that and I would use the fenics FEM package to define the matrices. Would this be okay? And if that’s the case, should I post the example here or at the petsc gitlab?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Sebastian<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><p class=MsoNormal>--<o:p></o:p></p><p class=MsoNormal>Dr. Sebastian Blauth<o:p></o:p></p><p class=MsoNormal>Fraunhofer-Institut für<o:p></o:p></p><p class=MsoNormal>Techno- und Wirtschaftsmathematik ITWM<o:p></o:p></p><p class=MsoNormal>Abteilung Transportvorgänge<o:p></o:p></p><p class=MsoNormal>Fraunhofer-Platz 1, 67663 Kaiserslautern<o:p></o:p></p><p class=MsoNormal>Telefon: +49 631 31600-4968<o:p></o:p></p><p class=MsoNormal><a href="mailto:sebastian.blauth@itwm.fraunhofer.de">sebastian.blauth@itwm.fraunhofer.de</a><o:p></o:p></p><p class=MsoNormal><a href="https://www.itwm.fraunhofer.de">https://www.itwm.fraunhofer.de</a><o:p></o:p></p></div><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> Barry Smith <bsmith@petsc.dev> <br><b>Sent:</b> Tuesday, July 9, 2024 3:32 PM<br><b>To:</b> Blauth, Sebastian <sebastian.blauth@itwm.fraunhofer.de>; Munson, Todd <tmunson@mcs.anl.gov>; toby Isaac <toby.isaac@gmail.com><br><b>Cc:</b> petsc-users@mcs.anl.gov<br><b>Subject:</b> Re: [petsc-users] Questions on TAO and gradient norm / inner products<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>   From <o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'>$ git grep TaoGradientNorm <o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>bound/impls/blmvm/blmvm.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>  PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>bound/impls/blmvm/blmvm.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>    PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>bound/impls/bnk/bnk.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>  PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &bnk->gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>bound/impls/bnk/bnk.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>          PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &bnk->gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>bound/impls/bnk/bnls.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>      PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &bnk->gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>bound/impls/bnk/bntl.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>      PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &bnk->gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>bound/impls/bnk/bntl.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>        PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &bnk->gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>bound/impls/bnk/bntr.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>        PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &bnk->gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>interface/taosolver.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>.seealso: [](ch_tao), `Tao`, `TaoGetGradientNorm()`, `<b><span style='color:#B42419'>TaoGradientNorm</span></b>()`<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>interface/taosolver.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>.seealso: [](ch_tao), `Tao`, `TaoSetGradientNorm()`, `<b><span style='color:#B42419'>TaoGradientNorm</span></b>()`<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>interface/taosolver.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>  <b><span style='color:#B42419'>TaoGradientNorm</span></b> - Compute the norm using the `NormType`, the user has selected<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>interface/taosolver.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>PetscErrorCode <b><span style='color:#B42419'>TaoGradientNorm</span></b>(Tao tao, Vec gradient, NormType type, PetscReal *gnorm)<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>unconstrained/impls/lmvm/lmvm.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>  PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>unconstrained/impls/lmvm/lmvm.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>      PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>unconstrained/impls/nls/nls.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>  PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>unconstrained/impls/nls/nls.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>          PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>unconstrained/impls/nls/nls.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>    PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>unconstrained/impls/ntr/ntr.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>  PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>unconstrained/impls/ntr/ntr.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>        PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#C814C9'>unconstrained/impls/ntr/ntr.c</span><span style='font-size:10.5pt;font-family:"Menlo",serif;color:#2EAEBB'>:</span><span style='font-size:10.5pt;font-family:"Menlo",serif'>      PetscCall(<b><span style='color:#B42419'>TaoGradientNorm</span></b>(tao, tao->gradient, NORM_2, &gnorm));<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'><br><br><o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'>it appears only some of the algorithm implementations use the norm you provide. While <o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'><br><br><o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'> git grep VecNorm<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'><br><br><o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'>indicates many places where it is not used. Likely some of the other algorithm implementations could be easily "fixed" to support by<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'>changing the norm computed. But I am not an expert on the algorithms and don't know if all algorithms can mathematically support a user provided norm.<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'><o:p> </o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'>You are welcome to take a stab at making the change in an MR, or do you have a simple test problem with a mass matrix we can use to fix the<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'>"missing" implementations?<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'><o:p> </o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'>  Barry<o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'><br><br><o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'><br><br><o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'><br><br><o:p></o:p></span></p><p style='margin:0cm;font-variant-caps: normal;font-stretch: normal;font-size-adjust: none;font-kerning: auto;font-variant-alternates: normal;font-variant-ligatures: normal;font-variant-numeric: normal;font-variant-east-asian: normal;font-variant-position: normal;font-variant-emoji: normal;font-feature-settings: normal;font-optical-sizing: auto;font-variation-settings: normal'><span style='font-size:10.5pt;font-family:"Menlo",serif'><br><br><o:p></o:p></span></p><div><p class=MsoNormal><br><br><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>On Jul 9, 2024, at 3:47 AM, Blauth, Sebastian <<a href="mailto:sebastian.blauth@itwm.fraunhofer.de">sebastian.blauth@itwm.fraunhofer.de</a>> wrote:<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>Hello,<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US>I have some questions regarding TAO and the use the gradient norm.<span class=apple-converted-space> </span></span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US>First, I want to use a custom inner product for the optimization in TAO (for computing the gradient norm and, e.g., in the double loop of a quasi-Newton method). I have seen that there is the method TAOSetGradientNorm<span class=apple-converted-space> </span><a href="https://petsc.org/release/manualpages/Tao/TaoSetGradientNorm/"><span style='color:#0563C1'>https://petsc.org/release/manualpages/Tao/TaoSetGradientNorm/</span></a><span class=apple-converted-space> </span>which seems to do this. According to the petsc4py docs<span class=apple-converted-space> </span><a href="https://petsc.org/release/petsc4py/reference/petsc4py.PETSc.TAO.html#petsc4py.PETSc.TAO.setGradientNorm"><span style='color:#0563C1'>https://petsc.org/release/petsc4py/reference/petsc4py.PETSc.TAO.html#petsc4py.PETSc.TAO.setGradientNorm</span></a>, this should do what I want. However, the method does not always seem to perform correctly: When I use it with “-tao_type lmvm”, it really seems to work and gives the correct scaling of the residual in the default TAO monitor. However, when I use, e.g., “-tao_type bqnls”, “-tao_type cg”, or “-tao_type bncg”, the (initial) residual is the same as it is when I do not use the TAOSetGradientNorm. However, there seem to be some slight internal changes (at least for the bqnls), as the number of iterations to reach the tolerance changes from 15 without TAOSetGradientNorm to 17 with TAOSetGradientNorm.<span class=apple-converted-space> </span></span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US>For the context: Here, I am trying to solve a PDE constrained optimal control problem, which I tackle in a reduced fashion (using a reduced cost functional which results in an unconstrained optimization using the adjoint approach). For this, I would like to use the L2 inner product induced by the FEM discretization, so the L2 mass matrix.</span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US>Moreover, I noticed that the performance of “-tao_type lmvm” and “-tao_type bqnls” as well as “-tao_type cg” and “-tao_type bncg” are drastically different for the same unconstrained problem. I would have expected that the algorithms are (more or less) identical for that case. Is this to be expected?</span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US>Finally, I would like to use TAO for solving PDE constrained shape optimization problems. To do so, I would need to be able to specify the inner product used in the solver (see the above part) and this inner product would need to change in each iteration. Is it possible to do this with TAO? And could anyone give me some hints how to do so in python with petsc4py?</span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US>Thanks a lot in advance,</span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US>Sebastian</span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p></div><div><p class=MsoNormal><span lang=EN-US> </span><o:p></o:p></p></div><div><p class=MsoNormal>--<o:p></o:p></p></div><div><p class=MsoNormal>Dr. Sebastian Blauth<o:p></o:p></p></div><div><p class=MsoNormal>Fraunhofer-Institut für<o:p></o:p></p></div><div><p class=MsoNormal>Techno- und Wirtschaftsmathematik ITWM<o:p></o:p></p></div><div><p class=MsoNormal>Abteilung Transportvorgänge<o:p></o:p></p></div><div><p class=MsoNormal>Fraunhofer-Platz 1, 67663 Kaiserslautern<o:p></o:p></p></div><div><p class=MsoNormal>Telefon: +49 631 31600-4968<o:p></o:p></p></div><div><p class=MsoNormal><a href="mailto:sebastian.blauth@itwm.fraunhofer.de">sebastian.blauth@itwm.fraunhofer.de</a><o:p></o:p></p></div><div><p class=MsoNormal><a href="https://www.itwm.fraunhofer.de/">https://www.itwm.fraunhofer.de</a><o:p></o:p></p></div></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>