# How do i print the RNS limbs of a ciphertext to stdout?

**URL:** <https://openfhe.discourse.group/t/how-do-i-print-the-rns-limbs-of-a-ciphertext-to-stdout/929>\
**Category:** Library Questions\
**Created:** [November 20, 2023, 7:37pm UTC](https://openfhe.discourse.group/t/how-do-i-print-the-rns-limbs-of-a-ciphertext-to-stdout/929 "2023-11-20T19:37:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SuperMusey](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@SuperMusey](https://openfhe.discourse.group/u/SuperMusey)\
**Post date:** [November 20, 2023, 7:37pm UTC](https://openfhe.discourse.group/t/how-do-i-print-the-rns-limbs-of-a-ciphertext-to-stdout/929/1 "2023-11-20T19:37:44Z")

</div>

I am pretty new to using the library and had a question about displaying the RNS limbs of the ciphertext to the console. Right now when I print the ciphertext, I get an output of the form:

0: EVAL [numbers] modulus: number  
1: EVAL [numbers] modulus: number

I understand from other topics that the crypto objects are composed of polynomials (DCRTPoly for RNS, which is what I am working with), and that the output from just printing the ciphertext shows those polynomials.

So my question is whether I can print just the ciphertext limbs?

---

<div class="post-metadata">

**Author:** ![Caesar](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/caesar/32/63_2.png) [@Caesar](https://openfhe.discourse.group/u/Caesar)\
**Post date:** [November 24, 2023, 6:36pm UTC](https://openfhe.discourse.group/t/how-do-i-print-the-rns-limbs-of-a-ciphertext-to-stdout/929/2 "2023-11-24T18:36:27Z")

</div>

I am not sure I understood your question right, but if you print out a ciphertext in OpenFHE v1.1.1, you might get something like the following:

```auto
Element 0: 0: EVAL: [vector of numbers] modulus: number
1: EVAL: [vector of numbers] modulus: number
.
.
.
Element 1: 0: EVAL: [vector of numbers] modulus: number
1: EVAL: [vector of numbers] modulus: number
.
.
.

```

Each element above is a `DCRTPoly` matrix of size L \times N, where L is the number of RNS limbs the scheme is instantiated with and N is the ring dimension. The rows of the `DCRTPoly` matrix are the RNS limbs of the polynomial represented by the `DCRTPoly`. The moduli q\_i's at the end of each row are the RNS basis primes that are used to compose the underlying ciphertext coefficient modulus Q, where Q = \Pi\_{i=0}^{L} q\_i.

---

<div class="post-metadata">

**Author:** ![SuperMusey](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@SuperMusey](https://openfhe.discourse.group/u/SuperMusey)\
**Post date:** [November 29, 2023, 10:26pm UTC](https://openfhe.discourse.group/t/how-do-i-print-the-rns-limbs-of-a-ciphertext-to-stdout/929/3 "2023-11-29T22:26:01Z")

</div>

This is helpful thank you! Is there a quick way to check the value of L? I know I can get the ring dimension through a function, is there something similar for L?

---

<div class="post-metadata">

**Author:** ![Caesar](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/caesar/32/63_2.png) [@Caesar](https://openfhe.discourse.group/u/Caesar)\
**Post date:** [November 30, 2023, 2:54pm UTC](https://openfhe.discourse.group/t/how-do-i-print-the-rns-limbs-of-a-ciphertext-to-stdout/929/4 "2023-11-30T14:54:45Z")

</div>

You can use the following to get the number of limbs in a ciphertext:  
`ctxt->GetElements()[0].GetAllElements().size()`
