Hello guys, my OpenFHE application gets input vectors that are varying in size every time i run the code. So how can i set batchsize and numslots correctly in that scenario? Unfortunately, i have not yet fully understood the difference between the two sizes. For an precise application, both sizes should be aligned with the size of the input vector, right? The problem, however, is that only numbers to the power of two are accepted. So what can i do for example with an input vector of size 10 or 20? Set the values to 16 and 32? Then I have to reckon with imprecise results, right?
What exactly do these two values mean?
Many thanks in advance! =)
Hi, please first read the related questions on the forum regarding the batch size and number of slots, as they explain their meaning and how to set them. Relation between ring dimension, batch size, num slots and length, Ressources for Batching, OpenFHE SetSlots method: what is the usage scenario?, Relations between batch_size, ring dimension and array of values, How to do dynamic batch packaging of plaintext?
Why would the results be imprecise if you pad your vectors with zeroes up to the next power of two? As long as you correctly write the functionality on only the slots of interest, you should get the correct result. If garbage values get in the slots after the slots of interest, you can always zero them out by multiplying by a plaintext mask, e.g., [1,1,1,1,1,0,0,0].