0
$\begingroup$

I want to reduce the cost of number multiplication in the Matrix Multiplication. Is the multiplication of a number by $10^n$ or $2^n$ enforces a surplus cost in computer operations or it is just adding zeros at the end of the numbers? If there is not so cost, then an $O(n^2)$ algorithm for MM is available.

  • 0
    It depends on how you represent your numbers. For ieee binary floating point numbers, multiply by $10^n$ is likely more expensive than by $2^n$. The first case definitely needs rounding. I am not sure if modern CPU implements multiplying by 2 powers differently, because fp operations have became really really fast.2017-02-07
  • 0
    Thanks, I need a complete answer to the question. Is multiplying by powers of 10, just moving fp on the numbers or no?2017-02-07
  • 0
    Is the process of multiplying by the powers of the base number (2 or 10) depending the system, like the other multiplications which are interpreted as continuous sums?2017-02-07

1 Answers 1

1

Let us assume the standard IEEE binary floating point representation, that is a positive (machine) number is given by $$ x = 2^n \left( 1 + \sum_{i=1}^m x_i 2^{-i} \right) $$ for $x_i\in\{0, 1\}$, $n\in\mathbb Z$ with $|n| \le N$, and some fixed $m, N\in\mathbb N$. Then, $x$ is represented by $(x_1,\dotsc, x_m, n)$.

Multiplying $x$ by a 2-power, say $2^p$, results in a signed addition of $n$ and $p$ (with possible over-/underflow). So it is surely not just "moving numbers". Multiplying $x$ by a 10-power results in a full floating multiplication.

I am not sure if any CPU checks for 2-powers and exploits that. Multiplication with numbers of higher precision is more expensive. But, it is always constant given fixed precision.

  • 0
    Thanks a lot. So in the standard IEEE multiplying by 2-powers does not need the rounding.2017-02-08
  • 0
    @Danial if there are no under-/overflows, there is no rounding.2017-02-08