Re: [petsc-users] SLEPc - st_type cayley choice of shift and antishift

2019-09-27 Thread Michael Werner via petsc-users
Ah, yes, I didn't notice the difference. Now its working. Thank you!

Michael

Am 27.09.19 um 15:54 schrieb Jose E. Roman:
> I now see what is happening. In the expression of the paper the antishift has 
> different sign compared to the expression used in SLEPc (see the users 
> manual):
>
> (A-sigma*B)^{-1}*(A+nu*B)x = \theta x
>
> So nu=-sigma is a forbidden value, otherwise both factors cancel out (I will 
> fix the interface so that this is catched).
>
> In your case you should do -eps_target -1 -st_cayley_antishift -1
>
> Jose
>
>
>> El 27 sept 2019, a las 13:54, Michael Werner  
>> escribió:
>>
>> Yes, with sinvert its working. And using -eps_target instead of
>> -st_shift didn't change anything.
>>
>> I also just sent you the matrices for reproduction of the issue.
>>
>> Michael
>>
>> Am 27.09.19 um 13:32 schrieb Jose E. Roman:
>>> Try setting -eps_target -1 instead of -st_shift -1
>>> Does sinvert work with target -1?
>>> Can you send me the matrices so that I can reproduce the issue?
>>>
>>> Jose
>>>
>>>
 El 27 sept 2019, a las 13:11, Michael Werner  
 escribió:

 Thank you for the link to the paper, it's quite interesting and pretty
 close to what I'm doing. I'm currently also using the "inexact" approach
 for my application, and in general it works, as long as the ksp
 tolerance is low enough. However, I was hoping to speed up convergence
 towards the "interesting" eigenvalues by using Cayley.

 Now as a test I tried to follow the approach from your paper, choosing
 mu = -sigma, and mu in the order of magnitude of the imaginary part of
 the most amplified eigenvalue. I know the most amplified eigenvalue for
 my problem is -0.0398+0.724i, so I tried running SLEPc with the
 following settings:
 -st_type cayley
 -st_shift -1
 -st_cayley_antishift 1

 But I never get the correct eigenvalue, instead SLEPc returns only the
 value of st_shift:
 [0]  Number of iterations of the method: 1
 [0]  Solution method: krylovschur
 [0]  Number of requested eigenvalues: 1
 [0]  Stopping condition: tol=1e-08, maxit=19382
 [0]  Number of converged eigenpairs: 16
 [0] 
 [0]  k  ||Ax-kx||/||kx||
 [0]  - --
 [0]  -1.00  0.0281754
 [0]  -1.00  0.0286815
 [0]  -1.00  0.0109186
 [0]  -1.00   0.140883
 [0]  -1.00   0.203036
 [0]  -1.00 0.00801616
 [0]  -1.00  0.0526871
 [0]  -1.00   0.022244
 [0]  -1.00  0.0182197
 [0]  -1.00  0.0107924
 [0]  -1.00 0.00963378
 [0]  -1.00  0.0239422
 [0]  -1.00 0.00472435
 [0]  -1.00 0.00607732
 [0]  -1.00  0.0124056
 [0]  -1.00 0.00557715

 Also, it doesn't matter if I'm using exact or inexact solves. Changing
 the values of shift and antishift also doesn't change the behaviour. Do
 I need to make additional adjustments to get cayley to work?

 Best regards,
 Michael



 Am 25.09.19 um 17:21 schrieb Jose E. Roman:
>> El 25 sept 2019, a las 16:18, Michael Werner via petsc-users 
>>  escribió:
>>
>> Hello,
>>
>> I'm looking for advice on how to set shift and antishift for the cayley
>> spectral transformation. So far I've been using sinvert to find the
>> eigenvalues with the smallest real part (but possibly large imaginary
>> part). For this, I use the following options:
>> -st_type sinvert
>> -eps_target -0.05
>> -eps_target_real
>>
>> With sinvert, it is easy to understand how to chose the target, but for
>> Cayley I'm not sure how to set shift and antishift. What is the
>> mathematical meaning of the antishift?
>>
>> Best regards,
>> Michael Werner
> In exact arithmetic, both shift-and-invert and Cayley build the same 
> Krylov subspace, so no difference. If the linear solves are computed 
> "inexactly" (iterative solver) then Cayley may have some advantage, but 
> it depends on the application. Also, iterative solvers usually are not 
> robust enough in this context. You can see the discussion here 
> https://doi.org/10.1108/09615530410544328
>
> Jose
>
>>
>>
>>

-- 



Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
Institut für Aerodynamik und Strömungstechnik | Bunsenstr. 10 | 37073 Göttingen

Michael Werner 
Telefon 0551 709-2627 | Telefax 0551 709-2811 | michael.wer...@dlr.de
DLR.de











Re: [petsc-users] SLEPc - st_type cayley choice of shift and antishift

2019-09-27 Thread Jose E. Roman via petsc-users
I now see what is happening. In the expression of the paper the antishift has 
different sign compared to the expression used in SLEPc (see the users manual):

(A-sigma*B)^{-1}*(A+nu*B)x = \theta x

So nu=-sigma is a forbidden value, otherwise both factors cancel out (I will 
fix the interface so that this is catched).

In your case you should do -eps_target -1 -st_cayley_antishift -1

Jose


> El 27 sept 2019, a las 13:54, Michael Werner  escribió:
> 
> Yes, with sinvert its working. And using -eps_target instead of
> -st_shift didn't change anything.
> 
> I also just sent you the matrices for reproduction of the issue.
> 
> Michael
> 
> Am 27.09.19 um 13:32 schrieb Jose E. Roman:
>> Try setting -eps_target -1 instead of -st_shift -1
>> Does sinvert work with target -1?
>> Can you send me the matrices so that I can reproduce the issue?
>> 
>> Jose
>> 
>> 
>>> El 27 sept 2019, a las 13:11, Michael Werner  
>>> escribió:
>>> 
>>> Thank you for the link to the paper, it's quite interesting and pretty
>>> close to what I'm doing. I'm currently also using the "inexact" approach
>>> for my application, and in general it works, as long as the ksp
>>> tolerance is low enough. However, I was hoping to speed up convergence
>>> towards the "interesting" eigenvalues by using Cayley.
>>> 
>>> Now as a test I tried to follow the approach from your paper, choosing
>>> mu = -sigma, and mu in the order of magnitude of the imaginary part of
>>> the most amplified eigenvalue. I know the most amplified eigenvalue for
>>> my problem is -0.0398+0.724i, so I tried running SLEPc with the
>>> following settings:
>>> -st_type cayley
>>> -st_shift -1
>>> -st_cayley_antishift 1
>>> 
>>> But I never get the correct eigenvalue, instead SLEPc returns only the
>>> value of st_shift:
>>> [0]  Number of iterations of the method: 1
>>> [0]  Solution method: krylovschur
>>> [0]  Number of requested eigenvalues: 1
>>> [0]  Stopping condition: tol=1e-08, maxit=19382
>>> [0]  Number of converged eigenpairs: 16
>>> [0] 
>>> [0]  k  ||Ax-kx||/||kx||
>>> [0]  - --
>>> [0]  -1.00  0.0281754
>>> [0]  -1.00  0.0286815
>>> [0]  -1.00  0.0109186
>>> [0]  -1.00   0.140883
>>> [0]  -1.00   0.203036
>>> [0]  -1.00 0.00801616
>>> [0]  -1.00  0.0526871
>>> [0]  -1.00   0.022244
>>> [0]  -1.00  0.0182197
>>> [0]  -1.00  0.0107924
>>> [0]  -1.00 0.00963378
>>> [0]  -1.00  0.0239422
>>> [0]  -1.00 0.00472435
>>> [0]  -1.00 0.00607732
>>> [0]  -1.00  0.0124056
>>> [0]  -1.00 0.00557715
>>> 
>>> Also, it doesn't matter if I'm using exact or inexact solves. Changing
>>> the values of shift and antishift also doesn't change the behaviour. Do
>>> I need to make additional adjustments to get cayley to work?
>>> 
>>> Best regards,
>>> Michael
>>> 
>>> 
>>> 
>>> Am 25.09.19 um 17:21 schrieb Jose E. Roman:
> El 25 sept 2019, a las 16:18, Michael Werner via petsc-users 
>  escribió:
> 
> Hello,
> 
> I'm looking for advice on how to set shift and antishift for the cayley
> spectral transformation. So far I've been using sinvert to find the
> eigenvalues with the smallest real part (but possibly large imaginary
> part). For this, I use the following options:
> -st_type sinvert
> -eps_target -0.05
> -eps_target_real
> 
> With sinvert, it is easy to understand how to chose the target, but for
> Cayley I'm not sure how to set shift and antishift. What is the
> mathematical meaning of the antishift?
> 
> Best regards,
> Michael Werner
 In exact arithmetic, both shift-and-invert and Cayley build the same 
 Krylov subspace, so no difference. If the linear solves are computed 
 "inexactly" (iterative solver) then Cayley may have some advantage, but it 
 depends on the application. Also, iterative solvers usually are not robust 
 enough in this context. You can see the discussion here 
 https://doi.org/10.1108/09615530410544328
 
 Jose
 
> 
> 
> 
> 



Re: [petsc-users] SLEPc - st_type cayley choice of shift and antishift

2019-09-27 Thread Michael Werner via petsc-users
Yes, with sinvert its working. And using -eps_target instead of
-st_shift didn't change anything.

I also just sent you the matrices for reproduction of the issue.

Michael

Am 27.09.19 um 13:32 schrieb Jose E. Roman:
> Try setting -eps_target -1 instead of -st_shift -1
> Does sinvert work with target -1?
> Can you send me the matrices so that I can reproduce the issue?
>
> Jose
>
>
>> El 27 sept 2019, a las 13:11, Michael Werner  
>> escribió:
>>
>> Thank you for the link to the paper, it's quite interesting and pretty
>> close to what I'm doing. I'm currently also using the "inexact" approach
>> for my application, and in general it works, as long as the ksp
>> tolerance is low enough. However, I was hoping to speed up convergence
>> towards the "interesting" eigenvalues by using Cayley.
>>
>> Now as a test I tried to follow the approach from your paper, choosing
>> mu = -sigma, and mu in the order of magnitude of the imaginary part of
>> the most amplified eigenvalue. I know the most amplified eigenvalue for
>> my problem is -0.0398+0.724i, so I tried running SLEPc with the
>> following settings:
>> -st_type cayley
>> -st_shift -1
>> -st_cayley_antishift 1
>>
>> But I never get the correct eigenvalue, instead SLEPc returns only the
>> value of st_shift:
>> [0]  Number of iterations of the method: 1
>> [0]  Solution method: krylovschur
>> [0]  Number of requested eigenvalues: 1
>> [0]  Stopping condition: tol=1e-08, maxit=19382
>> [0]  Number of converged eigenpairs: 16
>> [0] 
>> [0]  k  ||Ax-kx||/||kx||
>> [0]  - --
>> [0]  -1.00  0.0281754
>> [0]  -1.00  0.0286815
>> [0]  -1.00  0.0109186
>> [0]  -1.00   0.140883
>> [0]  -1.00   0.203036
>> [0]  -1.00 0.00801616
>> [0]  -1.00  0.0526871
>> [0]  -1.00   0.022244
>> [0]  -1.00  0.0182197
>> [0]  -1.00  0.0107924
>> [0]  -1.00 0.00963378
>> [0]  -1.00  0.0239422
>> [0]  -1.00 0.00472435
>> [0]  -1.00 0.00607732
>> [0]  -1.00  0.0124056
>> [0]  -1.00 0.00557715
>>
>> Also, it doesn't matter if I'm using exact or inexact solves. Changing
>> the values of shift and antishift also doesn't change the behaviour. Do
>> I need to make additional adjustments to get cayley to work?
>>
>> Best regards,
>> Michael
>>
>>
>>
>> Am 25.09.19 um 17:21 schrieb Jose E. Roman:
 El 25 sept 2019, a las 16:18, Michael Werner via petsc-users 
  escribió:

 Hello,

 I'm looking for advice on how to set shift and antishift for the cayley
 spectral transformation. So far I've been using sinvert to find the
 eigenvalues with the smallest real part (but possibly large imaginary
 part). For this, I use the following options:
 -st_type sinvert
 -eps_target -0.05
 -eps_target_real

 With sinvert, it is easy to understand how to chose the target, but for
 Cayley I'm not sure how to set shift and antishift. What is the
 mathematical meaning of the antishift?

 Best regards,
 Michael Werner
>>> In exact arithmetic, both shift-and-invert and Cayley build the same Krylov 
>>> subspace, so no difference. If the linear solves are computed "inexactly" 
>>> (iterative solver) then Cayley may have some advantage, but it depends on 
>>> the application. Also, iterative solvers usually are not robust enough in 
>>> this context. You can see the discussion here 
>>> https://doi.org/10.1108/09615530410544328
>>>
>>> Jose
>>>






Re: [petsc-users] SLEPc - st_type cayley choice of shift and antishift

2019-09-27 Thread Jose E. Roman via petsc-users
Try setting -eps_target -1 instead of -st_shift -1
Does sinvert work with target -1?
Can you send me the matrices so that I can reproduce the issue?

Jose


> El 27 sept 2019, a las 13:11, Michael Werner  escribió:
> 
> Thank you for the link to the paper, it's quite interesting and pretty
> close to what I'm doing. I'm currently also using the "inexact" approach
> for my application, and in general it works, as long as the ksp
> tolerance is low enough. However, I was hoping to speed up convergence
> towards the "interesting" eigenvalues by using Cayley.
> 
> Now as a test I tried to follow the approach from your paper, choosing
> mu = -sigma, and mu in the order of magnitude of the imaginary part of
> the most amplified eigenvalue. I know the most amplified eigenvalue for
> my problem is -0.0398+0.724i, so I tried running SLEPc with the
> following settings:
> -st_type cayley
> -st_shift -1
> -st_cayley_antishift 1
> 
> But I never get the correct eigenvalue, instead SLEPc returns only the
> value of st_shift:
> [0]  Number of iterations of the method: 1
> [0]  Solution method: krylovschur
> [0]  Number of requested eigenvalues: 1
> [0]  Stopping condition: tol=1e-08, maxit=19382
> [0]  Number of converged eigenpairs: 16
> [0] 
> [0]  k  ||Ax-kx||/||kx||
> [0]  - --
> [0]  -1.00  0.0281754
> [0]  -1.00  0.0286815
> [0]  -1.00  0.0109186
> [0]  -1.00   0.140883
> [0]  -1.00   0.203036
> [0]  -1.00 0.00801616
> [0]  -1.00  0.0526871
> [0]  -1.00   0.022244
> [0]  -1.00  0.0182197
> [0]  -1.00  0.0107924
> [0]  -1.00 0.00963378
> [0]  -1.00  0.0239422
> [0]  -1.00 0.00472435
> [0]  -1.00 0.00607732
> [0]  -1.00  0.0124056
> [0]  -1.00 0.00557715
> 
> Also, it doesn't matter if I'm using exact or inexact solves. Changing
> the values of shift and antishift also doesn't change the behaviour. Do
> I need to make additional adjustments to get cayley to work?
> 
> Best regards,
> Michael
> 
> 
> 
> Am 25.09.19 um 17:21 schrieb Jose E. Roman:
>> 
>>> El 25 sept 2019, a las 16:18, Michael Werner via petsc-users 
>>>  escribió:
>>> 
>>> Hello,
>>> 
>>> I'm looking for advice on how to set shift and antishift for the cayley
>>> spectral transformation. So far I've been using sinvert to find the
>>> eigenvalues with the smallest real part (but possibly large imaginary
>>> part). For this, I use the following options:
>>> -st_type sinvert
>>> -eps_target -0.05
>>> -eps_target_real
>>> 
>>> With sinvert, it is easy to understand how to chose the target, but for
>>> Cayley I'm not sure how to set shift and antishift. What is the
>>> mathematical meaning of the antishift?
>>> 
>>> Best regards,
>>> Michael Werner
>> In exact arithmetic, both shift-and-invert and Cayley build the same Krylov 
>> subspace, so no difference. If the linear solves are computed "inexactly" 
>> (iterative solver) then Cayley may have some advantage, but it depends on 
>> the application. Also, iterative solvers usually are not robust enough in 
>> this context. You can see the discussion here 
>> https://doi.org/10.1108/09615530410544328
>> 
>> Jose
>> 



Re: [petsc-users] SLEPc - st_type cayley choice of shift and antishift

2019-09-27 Thread Michael Werner via petsc-users
Thank you for the link to the paper, it's quite interesting and pretty
close to what I'm doing. I'm currently also using the "inexact" approach
for my application, and in general it works, as long as the ksp
tolerance is low enough. However, I was hoping to speed up convergence
towards the "interesting" eigenvalues by using Cayley.

Now as a test I tried to follow the approach from your paper, choosing
mu = -sigma, and mu in the order of magnitude of the imaginary part of
the most amplified eigenvalue. I know the most amplified eigenvalue for
my problem is -0.0398+0.724i, so I tried running SLEPc with the
following settings:
-st_type cayley
-st_shift -1
-st_cayley_antishift 1

But I never get the correct eigenvalue, instead SLEPc returns only the
value of st_shift:
[0]  Number of iterations of the method: 1
[0]  Solution method: krylovschur
[0]  Number of requested eigenvalues: 1
[0]  Stopping condition: tol=1e-08, maxit=19382
[0]  Number of converged eigenpairs: 16
[0] 
[0]  k  ||Ax-kx||/||kx||
[0]  - --
[0]  -1.00  0.0281754
[0]  -1.00  0.0286815
[0]  -1.00  0.0109186
[0]  -1.00   0.140883
[0]  -1.00   0.203036
[0]  -1.00 0.00801616
[0]  -1.00  0.0526871
[0]  -1.00   0.022244
[0]  -1.00  0.0182197
[0]  -1.00  0.0107924
[0]  -1.00 0.00963378
[0]  -1.00  0.0239422
[0]  -1.00 0.00472435
[0]  -1.00 0.00607732
[0]  -1.00  0.0124056
[0]  -1.00 0.00557715

Also, it doesn't matter if I'm using exact or inexact solves. Changing
the values of shift and antishift also doesn't change the behaviour. Do
I need to make additional adjustments to get cayley to work?

Best regards,
Michael



Am 25.09.19 um 17:21 schrieb Jose E. Roman:
>
>> El 25 sept 2019, a las 16:18, Michael Werner via petsc-users 
>>  escribió:
>>
>> Hello,
>>
>> I'm looking for advice on how to set shift and antishift for the cayley
>> spectral transformation. So far I've been using sinvert to find the
>> eigenvalues with the smallest real part (but possibly large imaginary
>> part). For this, I use the following options:
>> -st_type sinvert
>> -eps_target -0.05
>> -eps_target_real
>>
>> With sinvert, it is easy to understand how to chose the target, but for
>> Cayley I'm not sure how to set shift and antishift. What is the
>> mathematical meaning of the antishift?
>>
>> Best regards,
>> Michael Werner
> In exact arithmetic, both shift-and-invert and Cayley build the same Krylov 
> subspace, so no difference. If the linear solves are computed "inexactly" 
> (iterative solver) then Cayley may have some advantage, but it depends on the 
> application. Also, iterative solvers usually are not robust enough in this 
> context. You can see the discussion here 
> https://doi.org/10.1108/09615530410544328
>
> Jose
>


Re: [petsc-users] SLEPc - st_type cayley choice of shift and antishift

2019-09-25 Thread Jose E. Roman via petsc-users



> El 25 sept 2019, a las 16:18, Michael Werner via petsc-users 
>  escribió:
> 
> Hello,
> 
> I'm looking for advice on how to set shift and antishift for the cayley
> spectral transformation. So far I've been using sinvert to find the
> eigenvalues with the smallest real part (but possibly large imaginary
> part). For this, I use the following options:
> -st_type sinvert
> -eps_target -0.05
> -eps_target_real
> 
> With sinvert, it is easy to understand how to chose the target, but for
> Cayley I'm not sure how to set shift and antishift. What is the
> mathematical meaning of the antishift?
> 
> Best regards,
> Michael Werner

In exact arithmetic, both shift-and-invert and Cayley build the same Krylov 
subspace, so no difference. If the linear solves are computed "inexactly" 
(iterative solver) then Cayley may have some advantage, but it depends on the 
application. Also, iterative solvers usually are not robust enough in this 
context. You can see the discussion here 
https://doi.org/10.1108/09615530410544328

Jose