[petsc-users] SLEPc function SlepcSortEigenvalues

Jose E. Roman jroman at dsic.upv.es
Tue Apr 7 15:32:47 CDT 2015


Something like this:

#include <slepcsc.h>
  SlepcSC sc;
  ierr = PetscNew(&sc);CHKERRQ(ierr);
  sc->comparison    = my_sort_function;
  sc->comparisonctx = NULL;
  sc->map           = NULL;
  sc->mapobj        = NULL;
  ierr = SlepcSortEigenvalues(sc,eps->nconv,eps->eigr,eps->eigi,eps->perm);CHKERRQ(ierr);

where the signature of my_sort_function should be:

  PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);

Jose


El 07/04/2015, a las 21:59, Michael Povolotskyi escribió:

> Hi, I have a related question.
> I need to sort eigenvectors after the eigenvalue problem is solved.
> For PETSC/SLEPC 3.4 I do the following
> 
> EPSSetEigenvalueComparison(eps, &my_sort_function, NULL);
> eps->which = EPS_WHICH_USER;
> ierr = EPSSortEigenvalues(eps,eps->nconv,eps->eigr,eps->eigi, eps->perm);
> 
> 
> How should I modify the code for PETSc/SLEPc 3.5?
> Thank you,
> Michael.
> 
> On 04/07/2015 03:42 PM, Jose E. Roman wrote:
>> El 07/04/2015, a las 21:29, Daniel A Lemus escribió:
>> 
>>> Hi,
>>> 
>>> I'm using SLEPc version 3.5.3 and it seems that EPSSortEigenvalues was replaced with SlepcSortEigenvalues in a recent release.
>>> 
>>> I can find very little documentation on this SlepcSortEigenvalues function and the SlepcSC argument it takes. There is also no mention of these changes in the SLEPc changes list.
>>> 
>>> Are there any examples on how to use this function and how to set the SlepcSC sorting criterion?
>>> 
>>> Thanks,
>>> Daniel
>> This function is intended for internal use only, not for application code, that is why it is not well documented. Here is the manpage:
>> http://slepc.upv.es/documentation/current/docs/manualpages/sys/SlepcSortEigenvalues.html
>> 
>> The 'sorting criterion' argument SlepcSC is used in some of the test examples of the DS auxiliary class, e.g.
>> http://slepc.upv.es/documentation/current/src/sys/classes/ds/examples/tests/test1.c.html
>> 
>> Basically it is a struct containing a sorting function and a mapping function, possibly with data contexts.
>> 
>> This functionality is not available from Fortran.
>> 
>> Jose
>> 
> 



More information about the petsc-users mailing list