<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
I am using the following procedure to read from Vec, but it keeps giving me the same values! I was told that using VecGetValues gives wrog output. If not this, then what function should be used to read the contents of a vector?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
for (int i = 0; i < nconv; i++)
<div class="ContentPasted0">        {</div>
<div class="ContentPasted0">            PetscCall(EPSGetEigenpair(eps,i,&kr,&ki,xr,xi));</div>
<div class="ContentPasted0">            PetscCall(EPSComputeError(eps,i,EPS_ERROR_RELATIVE,&error1));</div>
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">            #if defined(PETSC_USE_COMPLEX)</div>
<div class="ContentPasted0">                re = PetscRealPart(kr);</div>
<div class="ContentPasted0">                im = PetscImaginaryPart(kr);</div>
<div class="ContentPasted0">            #else</div>
<div class="ContentPasted0">                re = kr;</div>
<div class="ContentPasted0">                im = ki;</div>
<div class="ContentPasted0">            #endif</div>
<div class="ContentPasted0">            if (im!=0.0) PetscCall(PetscPrintf(PETSC_COMM_WORLD," %9f%+9fi %12g\n",(double)re,(double)im,(double)error1));</div>
<div class="ContentPasted0">            else PetscCall(PetscPrintf(PETSC_COMM_WORLD,"   %12f       %12g\n",(double)re,(double)error1));</div>
<div class="ContentPasted0">            eval(i) = re;</div>
<div class="ContentPasted0">            VecGetValues(xr, tdof, ei, eveci);</div>
<div class="ContentPasted0">            for (int j = 0; j < tdof; j++)</div>
<div class="ContentPasted0">            {</div>
<div class="ContentPasted0">                evec(j, i) = eveci[j];</div>
<div class="ContentPasted0">            }</div>
<div class="ContentPasted0">        }</div>
        PetscCall(PetscPrintf(PETSC_COMM_WORLD,"\n"));<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
Thank you</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
Ali</div>
</body>
</html>