Can someone please tell me how I can implement the following line of pseudo-code.
c[k]=c[k] (mod M) with |c[k]|<=M/2
I do not understand what the ‘with’ means, does it mean that I have to ensure that after reduction modulo M, c[k] must be less than or equal to M/2. What does ‘with’ usually mean (if anything) in pseudo-code?
Note that M is of type int. I’m implementing this in Java if it helps.
Thanks in advance.
I think it means set
c[k] = c[k] + x*M, where-M/2 <= c[k] + x*M <= M/2(choose the positive or negative integerxsuch that this is true).For example, if M = 5, we would have:
Previous value New value of c[k] of c[k] 8 -2 9 -1 10 0 11 1 12 2 13 -2