Sorting a vector
Matthew Knepley
knepley at gmail.com
Tue Jun 16 09:51:29 CDT 2009
On Tue, Jun 16, 2009 at 8:30 AM, tog <guillaume.alleon at gmail.com> wrote:
> Thanks Matthew,
>
> Well I am interested by the parallel case unfortunately ;)
> Any reference paper that could help me to implement this ?
Maybe you can use STAPL (http://parasol.tamu.edu/stapl/)
Matt
>
> Guillaume
>
>
> On Tue, Jun 16, 2009 at 8:56 PM, Matthew Knepley <knepley at gmail.com>wrote:
>
>> On Tue, Jun 16, 2009 at 5:38 AM, tog <guillaume.alleon at gmail.com> wrote:
>>
>>> Hi there
>>>
>>> This is a kind of newbie question :)
>>> 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 ?
>>
>>
>> You can get p=1 with VecMax().
>>
>>
>>>
>>> What if I want to sort my vector to get the indices in ascending order of
>>> their values ?
>>
>>
>> The p=2+ and permutation cases are sophisticated in parallel and not
>> present. In serial, you can use
>> VecGetArray() and PetscSortReal()/SortRealWithPermutation().
>>
>> Matt
>>
>>
>>>
>>> Thanks
>>> Guillaume
>>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>
>
>
> --
> PGP KeyID: 1024D/69B00854 subkeys.pgp.net
>
> http://cheztog.blogspot.com
>
--
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090616/11299b46/attachment.htm>
More information about the petsc-users
mailing list