Boost logo

Boost :

Subject: Re: [boost] [Review Request] Multiprecision Arithmetic Library
From: Andreas Pokorny (andreas.pokorny_at_[hidden])
Date: 2012-04-08 16:02:35


I am not sure whether it fits into the scope of the Multiprecision
Library. In my graduation
work I implemented a small library that did transformations on
expression templates. The
expression templates supported matrix operations. You could write something like
   result = A*b + C*d;
where A and C are matrices and b and d are vector.
If nothing is specified the expression is evaluated at the assignment.
But one could also write:
  result[gmp<1024>] = A*b + C*d;
  result[k_fold<6>] = A*b + C*d;
or even
  result[accurate] = A*b + C*d;

gmp stands for the GMP backend, k_fold for k - fold precision of the
source type. Implemented
by k fold accumulations of errors. Accurate sum refers to a algorithm
invented and published by
S.M Rump T. Ogita et al in a paper called "Accurate Floating Point Summation".
The accurate implementation executes the summations by traversing
capturing only the values
with relevant mantiassas in the current exponent regions, until no
further values are contributed.
As a result, "normal" input performs nearly as fast as a recursive
sum. Ill conditioned input
takes as many iterations as needed to reach a result in the source
precision. Well, in my tests
k_fold<8> performed better than gmp, and accurate similar to k_fold<4>

So in my opinion if the range of 64 and 32 floating point is detailed
enough tuning the calculations
that are prone to ill conditioned floating point summations, is
usually better than using a library that
does floating point calculations with a higher precision.

Andreas Pokorny

Boost list run by bdawes at, gregod at, cpdaniel at, john at