# EPSSetInitialSpace set in FreeFem

**URL:** https://community.freefem.org/t/epssetinitialspace-set-in-freefem/3087
**Category:** General Discussion
**Created:** [April 8, 2024, 2:40am UTC](https://community.freefem.org/t/epssetinitialspace-set-in-freefem/3087 "2024-04-08T02:40:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![WeiQLiu](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/weiqliu/32/1043_2.png) [@WeiQLiu](https://community.freefem.org/u/WeiQLiu)
#### Post date: [April 8, 2024, 2:40am UTC](https://community.freefem.org/t/epssetinitialspace-set-in-freefem/3087/1 "2024-04-08T02:40:18Z")

</div>

Dear all,  
Recently, I’m learning about SLEPc and I’m reading this help manual [slepc.pdf](https://slepc.upv.es/documentation/slepc.pdf). I find the Advanced Usage of EPS described in Chapter 2, section 6. Section 2.6.1 is about entering an initial guess into EPS.

This gives me a little insight that we can assign the calculated eigenmode to the next eigenvalues as an initial guess. In SLEPc, they provide the command `EPSSetInitialSpace(EPS eps, PetscInt n, Vec is[])`. However, I did not find similar examples in FreeFem. Is there anyone who can give me help or ideas?

Thank you in advance!

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [April 9, 2024, 4:59am UTC](https://community.freefem.org/t/epssetinitialspace-set-in-freefem/3087/2 "2024-04-09T04:59:48Z")

</div>

How many iterates does it take to solve your second eigenproblem?

---

<div class="post-metadata">

### Author: ![WeiQLiu](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/weiqliu/32/1043_2.png) [@WeiQLiu](https://community.freefem.org/u/WeiQLiu)
#### Post date: [April 9, 2024, 7:21am UTC](https://community.freefem.org/t/epssetinitialspace-set-in-freefem/3087/3 "2024-04-09T07:21:57Z")

</div>

Dear prj,

Thank you very much for your quick reply. If I didn’t use a special setting, this iterations of this eigenproblem wouldn’t be very large.

 ![222](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/3/3798eb313915d913f139eb9e029b56c9aac4203b.jpeg)

However, the calculation here appears to have a spurious eigenvalue with a growth rate greater than zero. Therefore, I want to try modifying the initial guess to see if this method can aviod spurious wigenvalue.

On the other hand, I am more interested in this method. In the future I may be able to compute much larger mesh quantities and problems with very many parameters, and the command `EPSSetInitialSpace()` may be necessary to speed up the computation.

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [April 9, 2024, 4:18pm UTC](https://community.freefem.org/t/epssetinitialspace-set-in-freefem/3087/4 "2024-04-09T16:18:31Z")

</div>

You can look in `plugin/mpi/SLEPc-code.hpp` how `EPSSetInitialSpace()` is called. Basically, you need to use the argument `vectors` in `EPSSolve()`. But there is probably something wrong in your script, what spectral transformation are you using?

---

<div class="post-metadata">

### Author: ![WeiQLiu](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/weiqliu/32/1043_2.png) [@WeiQLiu](https://community.freefem.org/u/WeiQLiu)
#### Post date: [April 10, 2024, 3:19am UTC](https://community.freefem.org/t/epssetinitialspace-set-in-freefem/3087/5 "2024-04-10T03:19:10Z")

</div>

Thank you very much for your help. I may not fully understand this file `plugin/mpi/SLEPc-code.hpp` for the time being. I‘ll take more time to understand it.

In terms of spectral transformation, I’m using:

 ![111](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/d/d7467453738378c06d01a2bd4ecfa1dcb58cf5b4.jpeg)

In fact, I didn’t try other method of spectral transformation. Do you think this parameter setting is wrong? However, among the four eigenvalue calculated above, the first one is correct one I need to require, and the second unstable one is the eigenvalue I think is wrong, and this eigenvalue will not converge significantly with mesh encryption.

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [April 10, 2024, 5:41am UTC](https://community.freefem.org/t/epssetinitialspace-set-in-freefem/3087/6 "2024-04-10T05:41:50Z")

</div>

Such a tolerance (lower than machine epsilon) does not make sense.

---

<div class="post-metadata">

### Author: ![WeiQLiu](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/weiqliu/32/1043_2.png) [@WeiQLiu](https://community.freefem.org/u/WeiQLiu)
#### Post date: [April 10, 2024, 6:09am UTC](https://community.freefem.org/t/epssetinitialspace-set-in-freefem/3087/7 "2024-04-10T06:09:43Z")

</div>

Yes, it was just a wrong attempt at the time and had no effect on the result.
