# Problems in "OpenFHE integer examples" project

**URL:** <https://openfhe.discourse.group/t/problems-in-openfhe-integer-examples-project/285>\
**Category:** Library Questions\
**Tags:** questions, openfhe-help\
**Created:** [December 14, 2022, 12:49pm UTC](https://openfhe.discourse.group/t/problems-in-openfhe-integer-examples-project/285 "2022-12-14T12:49:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![smerte](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/smerte/32/83_2.png) [@smerte](https://openfhe.discourse.group/u/smerte)\
**Post date:** [December 14, 2022, 12:49pm UTC](https://openfhe.discourse.group/t/problems-in-openfhe-integer-examples-project/285/1 "2022-12-14T12:49:00Z")

</div>

I’m having weird behaviour when running **[openfhe-integer-examples](https://github.com/openfheorg/openfhe-integer-examples)** project (both examples).  
More details here: [mismatch in the total occurences between the cleartext and encrypted versions · Issue #2 · openfheorg/openfhe-integer-examples · GitHub](https://github.com/openfheorg/openfhe-integer-examples/issues/2)

Does anybody else get the same behavior?

---

<div class="post-metadata">

**Author:** ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)\
**Post date:** [December 14, 2022, 6:55pm UTC](https://openfhe.discourse.group/t/problems-in-openfhe-integer-examples-project/285/2 "2022-12-14T18:55:36Z")

</div>

I’m running into `plaintext extra finds X Y` so confirmed

---

<div class="post-metadata">

**Author:** ![smerte](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/smerte/32/83_2.png) [@smerte](https://openfhe.discourse.group/u/smerte)\
**Post date:** [December 21, 2022, 4:25pm UTC](https://openfhe.discourse.group/t/problems-in-openfhe-integer-examples-project/285/3 "2022-12-21T16:25:38Z")

</div>

It seems incorect resuts occur when setting the multiplicative depth too high.

1. For strsearch\_enc\_1, setting the depth less than 18 returns correct results.
2. For strsearch\_enc\_2 with SIMD, setting the depth low enougth while adjusting the text size and the maximum number of batches also returns correct results.

This is counterintuitive, how setting a higher depth than required causes problems?

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [January 19, 2023, 1:48am UTC](https://openfhe.discourse.group/t/problems-in-openfhe-integer-examples-project/285/4 "2023-01-19T01:48:03Z")

</div>

The problem is now fixed (in the `master` branch of [GitHub - openfheorg/openfhe-integer-examples: Integer examples for OpenFHE library. Based off of https://gitlab.com/palisade/palisade-integer-examples](https://github.com/openfheorg/openfhe-integer-examples)). Please try it when you get a chance.

---

<div class="post-metadata">

**Author:** ![smerte](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/smerte/32/83_2.png) [@smerte](https://openfhe.discourse.group/u/smerte)\
**Post date:** [January 19, 2023, 8:56am UTC](https://openfhe.discourse.group/t/problems-in-openfhe-integer-examples-project/285/5 "2023-01-19T08:56:52Z")

</div>

I see that the fix was in changing the RNS variants of the BFV scheme.  
@ypolyakov can you maybe give a guideline on when should I use each variant?

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [January 19, 2023, 4:10pm UTC](https://openfhe.discourse.group/t/problems-in-openfhe-integer-examples-project/285/6 "2023-01-19T16:10:44Z")

</div>

All RNS variants should work correctly and have roughly the same noise requirements. It appears we have a bug with `HPSPOVERQ` and `HPSPOVERQLEVELED` in OpenFHE. I created an issue for it: [Bug in HPSPOVERQ and HPSOVERQLEVELED · Issue #280 · openfheorg/openfhe-development · GitHub](https://github.com/openfheorg/openfhe-development/issues/280)
