<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br></div> Good question. Looking at the commit logs from 2014 I see <div><br></div><div><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; 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-variant-ligatures: no-common-ligatures">move tao vector operations over to Vec directory, fix a couple names and calling sequences</span></p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; 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-variant-ligatures: no-common-ligatures"><br></span></p><p style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; 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-variant-ligatures: no-common-ligatures"><br></span></p><div> So previously, the function was problem-specific for Tao (which did not support complex numbers) used inside the semi-smooth methods where roots of negative numbers should be mapped to infinity (indicating a "bad" domain point).</div><div><br></div><div> When we merged the Tao and PETSc source code base just blindly copied over the code without realizing it was not a general-purpose VecPow() and that it did not make sense for complex numbers.</div><div><br></div><div> I should rework it for general use without breaking the use in Tao.</div><div><br></div><div> Thanks for pointing out the problem.</div><div><br></div><div> Barry</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><blockquote type="cite"><div>On Nov 14, 2024, at 9:39 AM, Peder Jørgensgaard Olesen via petsc-users <petsc-users@mcs.anl.gov> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div id="Signature" class="elementToProof" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">Given a vector containing roots of unity, v[i] = exp(i*k*x[i]) I wanted to compute the vector u[i]=exp(i*n*k*x[i]), for some real number n. From the face of it this should be easily achieved with VecPow, as u[i] = v[i]^n.</div><div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;"><br></div><div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">That didn't work as expected, though I got around it using VecGetArray() and a loop with PetscPowComplex(). The source designated in the docs (src/vec/vec/utils/projection.c) reveals that VecPow() maps v[i] to PETSC_INFINITY when the PetscRealPart(v[i]) < 0, unless the power is any of 0, ±0.5, ±1 or ±2. Even in the simple case of a purely real vector (with negative entries) raised to any other integer power, the results would not be what one might reasonably expect from the description of VecPow().</div><div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;"><br></div><div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">While I do have a solution suiting my need, I'm left wondering what might be the rationale for VecPow working the way it does.</div><div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;"><br></div><div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">Best,</div><div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">Peder</div></div></div></blockquote></div><br></div></body></html>