Counting flops in log function

253 Views Asked by At

I am trying to do some complexity analysis counting the flops that the operations when evaluating a function would require, following section 9.7 from the book on Convex optimization by Boyd and Vandenberghe. Particularly, I am looking at the function $f(x) = - \sum_{i = 1}^m \log (b_i - a_i^Tx) $ when I evalute this function at $x + t \Delta x$. I thought that such an operation, $f(x + t\Delta x) = - \sum_{i = 1}^m \log (b_i - a_i^T(x+ t \Delta x)) $ would require $2mn - m = m(2n-1)$ flops since we have in total $2n-1$ flops from multiplications and additions from $a_i^T(x+ t \Delta x)$ and then we do this operations $m$ times, thus we have that the flop count would be $m(2n-1)$. However, the solutions of the book only say that the flop count should be $mn$. Why is this discrepancy? What is wrong with what I did or how do we end up concluding that the flop count is just $mn$?