[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #49076] Should perform matrix chain multiplica
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #49076] Should perform matrix chain multiplication optimization |
Date: |
Thu, 15 Sep 2016 12:35:15 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0 |
Follow-up Comment #1, bug #49076 (project octave):
You know that floating-point multiplication is not associative. Yes, it can
well be that an optimization with respect to performance is also advantageous
in terms of the accumulation of floating-point round errors, but do not forget
arithmetic overflow.
In any case, such an optimization would cost you due to added complexity in
the interpreter with every matrix multiplication. However, it would pay off
only for larger matrices, where such an optimization can always done by hand
(you demonstrate the solution for your particular case, and also I remember
instances in actual code where I took care to order the multiplications
optimally). So I am not certain whether your proposal would actually
correspond to a gain in the averaged case, even disregarding implementation
and maintenance effort, introduced bugs and so on. Note that this is different
from questions such as just-in-time compilation, where the added complexity to
the interpreter leads to less as opposed to more work being done in the
interpreter (provided the heuristics work).
Finally, I appreciate the present case where internally the natural thing
happens, as opposed to where I have to parenthesize all running products to
define the behaviour. Note that, as far as I know, for instance also gcc
without explicit instructions otherwise would not reorder floating-point
operations.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?49076>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/