From: Andy Little (andy_at_[hidden])
Date: 2006-09-05 15:46:12
"David Abrahams" <dave_at_[hidden]> wrote in message
> "Andy Little" <andy_at_[hidden]> writes:
>> The code below uses boost::tuple, but presumably fusion could do
>> this stuff better?
> I should note that one of the main reasons fusion tuples (which are
> "vector-like") are better for random access than boost::tuple (which
> is "slist-like") is that, even taking into account the memoizing
> nature of template instantiation, the latter generates O(N^2)
> instantiations to access N elements of a tuple with at<>, whereas the
> former takes only O(N).
Unfortunately I couldnt check out the relative compile time performance, as I
ran out of elements in Boost.Tuple when I tried making a 4 x 4 matrix, else I
would have stuck with it for the moment. ( I opted just to use one tuple)
However maybe its a good move to try out Boost.Fusion. Although the docs said
the move from tuple was as easy as changing from get to at, I found that there
was a big change, because AFAICS Fusion uses references everywhere, and the
compiler refused to assign anything, for reasons I am not clear on. Anyway after
changing from result_of::at_c to result_of::value_at_c things seemed to go more
smoothly. (That is using the Boost Review version of fusion). IOW I am
succcessfully fused !
FWIW compiling a 2x2, 3x3, and 4x4 with some quan::quantities in, a multiply of
each by itself and some output, takes about 22 seconds, on my AMD Atlhon 1.25Ghz
system The trickiest part is working out an algorithm to do cofactors of the
matrices (to get the inverse), but I may just hard code them, unless anyone has
any suggestions ...?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk