This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DualNumbers | |
# Solve the matrix system | |
# | |
# B = U'*M + M'*U | |
# | |
# for M where B is symmetric and U is upper triangular. This looks a bit like | |
# the *-Sylvester equation, but has significantly more symmetry. | |
function tri_ss_solve!{T<:Base.LinAlg.BlasFloat}(M::AbstractArray{T,2}, U::AbstractArray{T,2}, B::AbstractArray{T,2}) | |
# This turns out to be a forward substitution algorithm in terms of the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module GeneratedTypes | |
# First an example of a simple "generic" type | |
immutable GenericImmutable{FieldNames, FieldTypes<:Tuple} | |
fieldvalues::FieldTypes | |
end | |
@generated function getfield{FieldNames, FieldTypes, Name}(gi::GenericImmutable{FieldNames,FieldTypes},::Type{Val{Name}}) | |
fieldnumber = findfirst(FieldNames, Name) | |
fieldnumber > 0 || error("Field $name not found") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SimpleSymbolic | |
immutable S{Ex} | |
x::Ex | |
end | |
macro S(ex) | |
Expr(:call, :S, Expr(:quote, ex)) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
FILE* f = fopen("AUSGeoid09_GDA94_V1.01_DOV.txt", "r"); | |
if (!f || fscanf(f, "%*[^\n]\n") != 0) | |
return 1; | |
int hlen = 10; | |
int hindex = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
solve_divisor{T}(::Type{T},a,b,N) = solve_divisor(convert(T, a), convert(T, b), convert(T, N)) | |
function solve_divisor{T}(a::T, b::T, N::T) | |
#x = nextfloat(typemin(T)) | |
x = T(1) | |
while x < 2 #prevfloat(typemax(T)) | |
if ((a*x)*N)/(x*N) == a && ((b*x)*N)/(x*N) == b | |
return x | |
end | |
x = nextfloat(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using StaticArrays | |
import StaticArrays.SUnitRange | |
@noinline function inv2(a::StaticMatrix{4,4}) | |
# See http://www.freevec.org/function/inverse_matrix_4x4_using_partitioning | |
# Partition | |
i1 = SUnitRange(1,2) | |
i2 = SUnitRange(3,4) | |
@inbounds P = a[i1,i1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Unroll | |
struct Vec{N,T} <: AbstractVector{T} | |
data::NTuple{N,T} | |
end | |
Base.size(v::Vec) = (length(v.data),) | |
Base.getindex(v::Vec, i::Int) = v.data[i] | |
function _unroll_for(ex) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Chris Foster 4 days ago | |
Current notes are in my fork of the Juleps repo at | |
https://github.com/c42f/Juleps/blob/cjf/structured-concurrency/StructuredConcurrency.md | |
but most people seem to ignore the main Juleps repo so I haven't sent a PR yet (also it's very WIP). | |
We could move the notes to Jameson's julep wiki or somewhere else more conducive to collaboration? (edited) | |
Kiran Pamnany 3 days ago | |
This is nicely written -- good literature survey. | |
Kiran Pamnany 3 days ago | |
I'd be very interested in your (or anyone's) thoughts on Erlang's approach. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Base.Meta | |
struct ErrorResult{E} | |
e::E | |
end | |
function insert_wraparg!(ex, name) | |
@assert isexpr(ex, :call) # todo | |
insert!(ex.args, 2, name) | |
ex |
OlderNewer