Optimizations in C/C++ code doing matrix multiplications

"H. Ellenberger" <ele1@gmx.ch>
22 Mar 2002 21:03:51 -0500

          From comp.compilers

Related articles
Optimizations in C/C++ code doing matrix multiplications ele1@gmx.ch (H. Ellenberger) (2002-03-22)
Re: Optimizations in C/C++ code doing matrix multiplications ele1@gmx.ch (H. Ellenberger) (2002-03-31)
Re: Optimizations in C/C++ code doing matrix multiplications marjan.sterk@ijs.si (2002-03-31)
Re: Optimizations in C/C++ code doing matrix multiplications mark@marklacey.com (2002-04-06)
Re: Optimizations in C/C++ code doing matrix multiplications lars.gregersen@it.dk (2002-04-06)
Re: Optimizations in C/C++ code doing matrix multiplications terryg@qwest.net (Terry Greyzck) (2002-04-07)
| List of all articles for this month |

From: "H. Ellenberger" <ele1@gmx.ch>
Newsgroups: comp.compilers
Date: 22 Mar 2002 21:03:51 -0500
Organization: Swisscom IP+ (post doesn't reflect views of Swisscom)
Keywords: C, arithmetic, question
Posted-Date: 22 Mar 2002 21:03:51 EST

When matrix multiplication is programmed the same way it is
mathematically defined, then two nested loops running through all
valid indices are used.


When a simple compiler literally translates these accesses, then each
one requires a (slow) multiplication to calculate the offset into the
array.


Therefore in C/C++ this is most often hand coded as an increment to a
running pointer, which of course requires the programmer to exactly
know the layout of data (and thus in principle writing non portable
code).


Which compilers are smart enough to automagically optimize this kind
of data acess by introducing hidden pointer variables (in registers)
incremented and thus avoiding most multiplications?
[It's my impression that people who care about fast and, accurate matrix
multiplication use linpack rather than reinventing it. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.