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;| /** | |
| * 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 |
| 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!(); |
| import std.typetuple; | |
| import std.typecons; | |
| import std.traits; | |
| struct Pack(TL...) | |
| { | |
| alias expand = TL; | |
| enum length = TL.length; | |
| @disable this(); | |
| } |
| 2015-08-13 17:13:41 +0100 | |
| python3 | |
| setup.py | |
| build | |
| --fcompiler=gnu95 | |
| lapack_opt_info: | |
| openblas_lapack_info: | |
| C compiler: cc |
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; |
| import std.range, std.traits; | |
| import core.bitop : bsf; | |
| import std.stdio; | |
| /++ | |
| $(LUCKY Pairwise summation) algorithm. Range must be a finite range. | |
| +/ | |
| F sumPairwise(F, R)(R data) | |
| if(isInputRange!R && !isInfinite!R) |
| <table border="1" class="dataframe"> | |
| <thead> | |
| <tr style="text-align: right;"> | |
| <th></th> | |
| <th>Closest</th> | |
| <th>dist</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> |
| 2015-11-21 14:03:29 +0000 | |
| cmake | |
| .. | |
| -DCMAKE_C_FLAGS_RELEASE= | |
| -DCMAKE_CXX_FLAGS_RELEASE= | |
| -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/scalapack/2.0.2_4 | |
| -DCMAKE_BUILD_TYPE=Release | |
| -DCMAKE_FIND_FRAMEWORK=LAST | |
| -DCMAKE_VERBOSE_MAKEFILE=ON |
| def sigmoidContrastGetRawSlope(bias, slope): | |
| '''Get a value for rawSlope (as used in sigmoidContrast)''' | |
| import scipy.optimize | |
| import scipy.special | |
| assert slope >= 1, "slope must be in [1, oo]" | |
| if slope == 1: | |
| return 0 |