<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<p style="margin-right:0in;margin-left:0in;font-size:11pt;font-family:Calibri, sans-serif" class="ContentPasted0">
Dear PETSc community,<o:p class="ContentPasted0"> </o:p></p>
<p style="margin-right:0in;margin-left:0in;font-size:11pt;font-family:Calibri, sans-serif" class="ContentPasted0">
<br>
</p>
<p style="margin-right:0in;margin-left:0in;font-size:11pt;font-family:Calibri, sans-serif" class="ContentPasted0">
I have a question regarding the single precision complex numbers of petsc4py.<span style="mso-spacerun:yes" class="ContentPasted0">
</span>I configured PETSc with the “--with-scalar-type=complex --with-precision=single" option before compiling, but all the DA structures I created with petsc4py had double precision. </p>
<p style="margin-right:0in;margin-left:0in;font-size:11pt;font-family:Calibri, sans-serif" class="ContentPasted0">
<br>
</p>
<p style="margin-right:0in;margin-left:0in;font-size:11pt;font-family:Calibri, sans-serif" class="ContentPasted0">
Here is a minimum test code on Python 3.8/PETSc 3.12/petsc4py 3.12: both print commands show data type of complex128. Could anybody please help me? Thanks!</p>
<p style="margin-right:0in;margin-left:0in;font-size:11pt;font-family:Calibri, sans-serif" class="ContentPasted0">
<br>
</p>
<div style="margin: 0px 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="ContentPasted0">
<pre class="lang-py s-code-block" style="margin-top:0px;margin-bottom:calc(var(--s-prose-spacing) + 0.4em);padding:var(--su12);line-height:var(--lh-md);font-family:var(--ff-mono);font-size:var(--fs-body1);width:auto;max-height:600px;overflow:auto;background-color:var(--highlight-bg);border-radius:var(--br-md);color:var(--highlight-color);text-align:left"><code class="hljs language-python" style="margin:0px"><span class="hljs-keyword" style="margin:0px;font-size:13px;color:var(--highlight-keyword)">import</span> petsc4py
<span class="hljs-keyword" style="margin:0px;font-size:13px;color:var(--highlight-keyword)">import</span> sys
petsc4py.init(sys.argv)
<span class="hljs-keyword" style="margin:0px;font-size:13px;color:var(--highlight-keyword)">from</span> petsc4py <span class="hljs-keyword" style="margin:0px;font-size:13px;color:var(--highlight-keyword)">import</span> PETSc
da=PETSc.DA().create(sizes=[<span class="hljs-number" style="margin:0px;font-size:13px;color:var(--highlight-namespace)">2</span>,<span class="hljs-number" style="margin:0px;font-size:13px;color:var(--highlight-namespace)">2</span>,<span class="hljs-number" style="margin:0px;font-size:13px;color:var(--highlight-namespace)">2</span>],dof=<span class="hljs-number" style="margin:0px;font-size:13px;color:var(--highlight-namespace)">1</span>,stencil_type=<span class="hljs-number" style="margin:0px;font-size:13px;color:var(--highlight-namespace)">0</span>,stencil_width=<span class="hljs-number" style="margin:0px;font-size:13px;color:var(--highlight-namespace)">1</span>,boundary_type=<span class="hljs-number" style="margin:0px;font-size:13px;color:var(--highlight-namespace)">1</span>)
da_1 = da.createGlobalVec()
<span class="hljs-built_in" style="margin:0px;font-size:13px;color:var(--highlight-literal)">print</span>(petsc4py.PETSc.ComplexType)
<span class="hljs-built_in" style="margin:0px;font-size:13px;color:var(--highlight-literal)">print</span>(da_1.getArray().dtype)</code></pre>
<br>
</div>
<p style="margin-right:0in;margin-left:0in;font-size:11pt;font-family:Calibri, sans-serif" class="ContentPasted0">
<br>
</p>
<p style="margin-right:0in;margin-left:0in;font-size:11pt;font-family:Calibri, sans-serif" class="ContentPasted0">
<br>
</p>
<p style="margin-right:0in;margin-left:0in;font-size:11pt;font-family:Calibri, sans-serif" class="ContentPasted0">
Best regards,</p>
<p style="margin-right:0in;margin-left:0in;font-size:11pt;font-family:Calibri, sans-serif" class="ContentPasted0">
Peng Sun</p>
</div>
</body>
</html>