On Tue, Jun 16, 2009 at 5:38 AM, tog <span dir="ltr">&lt;<a href="mailto:guillaume.alleon@gmail.com">guillaume.alleon@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi there<br><br>This is a kind of newbie question :)<br>I have a vector which is the solution of my simulation, I want then to extract the p indices corresponding to the p biggest values in my vector. Is there a way to do this with PETSc ?</blockquote>
<div><br>You can get p=1 with VecMax().<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
What if I want to sort my vector to get the indices in ascending order of their values ?</blockquote><div><br>The p=2+ and permutation cases are sophisticated in parallel and not present. In serial, you can use<br>VecGetArray() and PetscSortReal()/SortRealWithPermutation().<br>
<br>  Matt<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Thanks<br>Guillaume<br>
</blockquote></div>-- <br>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<br>