# Limit number of iterations in CG

**URL:** <https://community.freefem.org/t/limit-number-of-iterations-in-cg/134>\
**Category:** General Discussion\
**Created:** [September 9, 2019, 1:14pm UTC](https://community.freefem.org/t/limit-number-of-iterations-in-cg/134 "2019-09-09T13:14:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [September 9, 2019, 1:14pm UTC](https://community.freefem.org/t/limit-number-of-iterations-in-cg/134/1 "2019-09-09T13:14:56Z")

</div>

Hello,

Is it possible to limit the number of iterations when using the CG algorithm ?

Best regards,  
Beniamin

---

<div class="post-metadata">

**Author:** ![simon.garnotel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/simon.garnotel/32/11_2.png) [@simon.garnotel](https://community.freefem.org/u/simon.garnotel)\
**Post date:** [September 10, 2019, 5:41am UTC](https://community.freefem.org/t/limit-number-of-iterations-in-cg/134/2 "2019-09-10T05:41:39Z")

</div>

As described [here](https://doc.freefem.org/documentation/algorithms-and-optimization.html#conjugate-gradient-gmres), you can specify `nbiter` that is the max number of iterations.

---

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [September 10, 2019, 6:39am UTC](https://community.freefem.org/t/limit-number-of-iterations-in-cg/134/3 "2019-09-10T06:39:43Z")

</div>

Thank you very much for the reference.
