I have the following pseudocode:
for j = 0 to argmax {l where t mod 2^l = 0} do
t is a counter being incremented outside of this for loop. My question is how to evaluate the argmax statement?

I believe the 'i' in the code to be a typo. 't' is probably correct.
There is no closed-form argmax function.
Argmax says find the parameter (argument) that maximizes the function.
Which can be arbitrarily complex, if you have a complex expression inside of the statement.
Here, it can maybe be implemented as a one-liner mathematical expression, the authors were just too lazy to spell out because of line length. Otherwise, if you have a finite integer domain, you can implement it using a loop:
def argmaximod2l(maxl, i):
for l in range(maxl, 0, -1):
if i % (2**l) == 0: return l
raise Exception("No l was divisible by i.")
if you have two integers, you can use nested loops; and if your parameters a doubles and you have a smooth convex function, you can use gradient descent methods.
In this particular case, the maximum l should be the number of trailing zeroes of i. There are much more efficient methods (there might also be a library function, e.g. Long.numberOfLeadingZeros in Java) available.
In this particular case, you might want to implement the loop as:
for (int j=0, i=t; (i&1)==0; j++, i>>>=1) {
...
}
Not quite sure if I am getting the gist of your question?
for (int j = 0; j < argmax; j++) {...}
So as argmax is a function, then
for (int j = 0; j < argmax(); j++) {...}
private int argmax () {return some int}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With