Skip to content

Instantly share code, notes, and snippets.

View kortschak's full-sized avatar

Dan Kortschak kortschak

View GitHub Profile
// Copyright ©2014 The gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package concrete
import (
"github.com/gonum/graph"
)
// ranker is a helper type for the rank function.
type ranker struct {
f []float64 // Data to be ranked.
r []int // A list of indexes into f that reflects rank order after sorting.
}
// ranker satisfies the sort.Interface without mutating the reference slice, f.
func (r ranker) Len() int { return len(r.f) }
func (r ranker) Less(i, j int) bool { return r.f[r.r[i]] < r.f[r.r[j]] }
func (r ranker) Swap(i, j int) { r.r[i], r.r[j] = r.r[j], r.r[i] }
@kortschak
kortschak / biogo-llrb_test.go
Created August 9, 2014 22:02
biogo llrb benchmark code
package biogollrb_test
import (
"testing"
"code.google.com/p/biogo.store/llrb"
"github.com/tv42/benchmark-ordered-map/fixture"
)
type llrbItemUnique fixture.Item
@kortschak
kortschak / materialize failure
Created August 12, 2014 01:04
out put of b74cb142f02bc7a0079cf080de1bd4c112b2acab failing backported test from https://github.com/kortschak/cayley/tree/issue114
--- FAIL: TestQueries (25.37 seconds)
cayley_test.go:357: Unexpected results for Net and Speed:
cayley_test.go:359:
got:[]interface {}{map[string]string{"movie1":"The Net", "movie2":"/film/film", "id":"Sandra Bullock"}}
expect:[]interface {}{map[string]string{"id":"Sandra Bullock", "movie1":"The Net", "movie2":"Speed"}}
cayley_test.go:357: Unexpected results for Keanu with other in The Net:
cayley_test.go:359:
got:[]interface {}{map[string]string{"costar1_movie":"/film/film", "id":"Sandra Bullock", "movie1":"The Net"}}
expect:[]interface {}{map[string]string{"id":"Sandra Bullock", "movie1":"The Net", "costar1_movie":"Speed"}}
cayley_test.go:359:
@kortschak
kortschak / race.txt
Created August 16, 2014 22:44
race condition in REPL crash fix
WARNING: DATA RACE
Write by goroutine 12:
github.com/google/cayley/query/gremlin.func·011()
/home/daniel/Development/src/github.com/google/cayley/query/gremlin/session.go:143 +0x1d1
Previous read by ****
id : /en/aries_spears
goroutine 11:
github.com/google/cayley/query/gremlin.runIteratorOnSession()
/home/daniel/Development/src/github.com/google/cayley/query/gremlin/finals.go:256 +0x1fa
@kortschak
kortschak / devcam-sess.text
Created September 9, 2014 01:10
devcam test failure
~/Development/src/camlistore.org [master*]$ go version
go version go1.3.1 linux/amd64
~/Development/src/camlistore.org [master*]$ git pull
Already up-to-date.
~/Development/src/camlistore.org [master*]$ git show
commit b55c4fdf1265a0f7f89ee64d0a5a4c8de766b158
Merge: 21f2861 906ef08
Author: Aaron Boodman <zboogs@gmail.com>
Date: Mon Sep 8 04:38:09 2014 +0000
@kortschak
kortschak / seen_quad.go
Created September 18, 2014 00:22
check quad data for duplicates
package main
import (
"compress/bzip2"
"fmt"
"os"
"github.com/google/cayley/quad"
"github.com/google/cayley/quad/nquads"
)
OSNAME=Linux
ARCH=x86_64
C_COMPILER=GCC
BINARY32=
BINARY64=1
CEXTRALIB=-L/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. -lc
F_COMPILER=GFORTRAN
FC=gfortran
BU=_
CORE=NEHALEM
digraph matdeps {
"client" -> "gonum/matrix/mat64" [label="mat64 calls"]
"client" -> "gonum/blas/blas64" [label="Use() call\lexcursion from mat64 API", style=dashed]
"client" -> "gonum/blas/blas" [label="excursion from mat64 API", style=dashed]
"client" -> "gonum/blas/cblas" [label="Use() parameter", style=dashed]
"client" -> "gonum/blas/goblas" [label="Use() parameter", style=dashed]
"gonum/matrix/mat64" -> "gonum/blas/blas64" [label="blas wrapper calls\lraw matrix types"]
"gonum/matrix/mat64" -> "gonum/blas/blas" [label="option parameter types"]
"gonum/blas/blas64" -> "gonum/blas/blas" [label="blas calls\loption parameter types"]
"gonum/blas/blas64" -> "gonum/blas/goblas" [label="default implementation"]
@kortschak
kortschak / single_precision
Created April 21, 2015 11:11
Fix for OSX sed newline issue.
#!/usr/bin/env bash
# Copyright ©2015 The gonum Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
WARNING="\n// Float32 implementations are autogenerated and not directly tested.\n"
# Level1 routines.