Skip to content

Instantly share code, notes, and snippets.

View lindahua's full-sized avatar

Dahua Lin lindahua

View GitHub Profile
@lindahua
lindahua / ju_sum.jl
Created December 16, 2013 22:19
A fast & accurate implementation of sum
# cascade sum
mid(i0::Integer, i1::Integer) = i0 + ((i1 - i0) >> 1)
function ssum{T}(a::AbstractArray{T}, ifirst::Int, ilast::Int)
n = ilast - ifirst + 1
if n < 4
s = zero(T)
i = ifirst
while i <= ilast
@lindahua
lindahua / regop.cpp
Created October 3, 2016 13:42
Simplified way to register operations (proof of concept)
// A proof-of-concept demonstration of Operation definition & registration
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <tuple>
#include <cassert>
#include <cmath>