A draft example of kahan sum as an input/forward range (I'm using double
just to make it a simple example):
struct KahanSum(R)
{
R r;
double sum = 0.0;
double c = 0.0;
this(R r)
{
this.r = r;
/++ | |
$(LUCKY Pairwise summation) algorithm. Range must be a finite range. | |
+/ | |
private F sumPairwise(Range, F = Unqual!(ForeachType!Range))(Range data) | |
if (isInputRange!Range && !isInfinite!Range) | |
{ | |
import core.bitop : bsf; | |
// Works for r with length < 2^^64, in keeping with the use of size_t | |
// elsewhere in std.algorithm and std.range on 64 bit platforms. | |
F[64] store = F.max; |
A draft example of kahan sum as an input/forward range (I'm using double
just to make it a simple example):
struct KahanSum(R)
{
R r;
double sum = 0.0;
double c = 0.0;
this(R r)
{
this.r = r;
2015-08-13 17:13:41 +0100 | |
python3 | |
setup.py | |
build | |
--fcompiler=gnu95 | |
lapack_opt_info: | |
openblas_lapack_info: | |
C compiler: cc |
import std.typetuple; | |
import std.typecons; | |
import std.traits; | |
struct Pack(TL...) | |
{ | |
alias expand = TL; | |
enum length = TL.length; | |
@disable this(); | |
} |
import std.range : isInputRange; | |
import std.array : front, empty, popFront; | |
template TypeTupleOf(TL...) | |
if (TL.length == 1 && isInputRange!(typeof(TL[0]))) | |
{ | |
import std.typetuple : TT = TypeTuple; | |
enum r = TL[0]; | |
static if (r.empty) | |
alias TypeTupleOf = TT!(); |
/** | |
* Explaination comments taken from: | |
* http://wiki.openstreetmap.org/wiki/PBF_Format#Design | |
* | |
* This gives a very basic parsing of osm.pbf files. The purpose was several | |
* fold. | |
* | |
* - Read PBF files | |
* - Learn the file layout | |
* - Verify the bytes match |