<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hei,</p>
    <p>thanks for the offer! Both options would be a possibility. Option
      one would be more specific, but I could imagine that implementing
      it using SSE/AVX-functions should be easier for better throughput.
      Option two would definitely be more flexible, but might loose the
      advantage of being able to use SSE/AVX functions. Or do you rely
      on higher-level commands for such constructions?</p>
    <p>By the way, why would that make cross-language things harder?<br>
    </p>
    <p>Thanks,</p>
    <p>regards,</p>
    <p>Roland<br>
    </p>
    <div class="moz-cite-prefix">Am 05.01.21 um 16:34 schrieb Matthew
      Knepley:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMYG4GnzWg+egAn2OA+RHOxoic6J3_jKFj4Yb=7Qv87+PgXewQ@mail.gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">On Tue, Jan 5, 2021 at 10:24 AM Roland Richter
          <<a href="mailto:roland.richter@ntnu.no"
            moz-do-not-send="true">roland.richter@ntnu.no</a>> wrote:<br>
        </div>
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">Hei,<br>
            <br>
            is there a function to square/cube etc. each element of a
            matrix or<br>
            vector in PETSc? It is rather useful for things like
            intensity<br>
            calculations (I = |E|^2), and should work also for
            distributed matrices.<br>
          </blockquote>
          <div><br>
          </div>
          <div>We don't have that. We tend to shy away from functions in
            the interface, since it makes cross-language</div>
          <div>things hard. However,</div>
          <div><br>
          </div>
          <div>1) I would be willing to add functions that you want,
            like square or cube, if you think it will make things
            easier for you.</div>
          <div><br>
          </div>
          <div>2) We could consider adding Vec/MatPointwiseFunction(A,
            f) where you apply a function f pointwise to each entry.</div>
          <div><br>
          </div>
          <div>  Thanks,</div>
          <div><br>
          </div>
          <div>     Matt</div>
          <div> </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            Thanks!<br>
            <br>
            Regards,<br>
            <br>
            Roland Richter<br>
            <br>
          </blockquote>
        </div>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div dir="ltr" class="gmail_signature">
          <div dir="ltr">
            <div>
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div>What most experimenters take for granted before
                      they begin their experiments is infinitely more
                      interesting than any results to which their
                      experiments lead.<br>
                      -- Norbert Wiener</div>
                    <div><br>
                    </div>
                    <div><a href="http://www.cse.buffalo.edu/~knepley/"
                        target="_blank" moz-do-not-send="true">https://www.cse.buffalo.edu/~knepley/</a><br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>