Boost logo

Boost :

Subject: [boost] [multi_array]inner_product interest?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2011-06-09 16:57:23


Attached is code to calculate the inner product of 2 multi_arrays.
As indicated in comments, the code was adapted from the Budd book.
It may be faster than doing subscripting to get the array elements;
however, I've done no benchmarks, but I'd guess it would be faster
since there's no calls to subscripting operators. Instead, there's
just one div call and 3 multiplications per element of the result
array.

The .txt attachment shows relevant quotes from the book and
reasons why changes were made to the book's code to accommodate
multi_array's different storage orders.

I've not done too much testing, but did do a simple test for
2 by 2 arrays whose output seems correct.

Any interest?

-regards,
Larry





Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk