Skip to content

Instantly share code, notes, and snippets.

size m pattern variant quicker std quicker/std
10 2 sawtooth ident 333.3 277.8 1.2
10 2 sawtooth reverse 312.5 250.0 1.2
10 2 sawtooth reverse_front 384.6 333.3 1.2
10 2 sawtooth reverse_back 384.6 333.3 1.2
10 2 sawtooth sorted 500.0 416.7 1.2
10 2 sawtooth dither 384.6 322.6 1.2
10 2 rand ident 111.1 108.7 1.0
10 2 rand reverse 116.3 111.1 1.0
10 2 rand reverse_front
@vks
vks / gist:eff0ce5526218e89917f
Created September 22, 2015 16:27
Vc compiler error with gcc 5.2.0
In file included from ~/src/Vc/include/Vc/vector.h:136:0,
from ~/src/Vc/include/Vc/Vc:22,
from ~/src/Vc/tests/unittest.h:43,
from ~/src/Vc/tests/subscript.cpp:24:
~/src/Vc/common/simdarray.h: In instantiation of ‘Vc_0::SimdArray<T, N, VectorType, VectorSize>::SimdArray(const std::initializer_list<_Tp>&) [with T = short int; long unsigned int N = 4ul; VectorType = Vc_0::Vector<short int, Vc_0::VectorAbi::Scalar>; long unsigned int <anonymous> = 1ul]’:
~/src/Vc/tests/subscript.cpp:296:36: required from ‘void fixedWidthGatherScatter4<V>::operator()() [with V = Vc_0::SimdArray<short int, 4ul>]’
~/src/Vc/tests/unittest.h:1377:59: required from ‘static void UnitTest::Test2Impl<TestFunctor, Index, 1ul, TestTypes ...>::call() [with TestFunctor = fixedWidthGatherScatter4; long unsigned int Index = 4ul; TestTypes = {Vc_0::SimdArray<int, 4ul, Vc_0::Vector<int, Vc_0::VectorAbi::Sse>, 4ul>, Vc_0::SimdArray<short unsigned int, 4ul, Vc_0::Vector<short unsigned int, Vc_0
/home/one/src/vc/tests/math.cpp: In instantiation of ‘void testFrexp() [with V = Vc_0::AVX2::Vector<float>]’:
/home/one/src/vc/tests/math.cpp:843:5: required from here
/home/one/src/vc/tests/math.cpp:772:33: error: no matching function for call to ‘frexp(const Vc_0::AVX2::Vector<float>&, ExpV*)’
const V fraction = frexp(v, &exp);
^
In file included from /usr/include/features.h:365:0,
from /usr/include/c++/5.1.0/x86_64-unknown-linux-gnu/bits/os_defines.h:39,
from /usr/include/c++/5.1.0/x86_64-unknown-linux-gnu/bits/c++config.h:482,
from /usr/include/c++/5.1.0/type_traits:38,
from /home/one/src/vc/tests/typelist.h:32,
@vks
vks / symbolic.rs
Last active November 15, 2017 22:25
Very basic implementation of symbolic algebra in Rust
#![feature(globs)]
use std::fmt;
use std::hash::Hash;
use Expr::*;
use MaybeOwned::*;
// TODO:
// * multiple dispatch
// * sorting of symbols
@vks
vks / gist:3d7db656c1ac22b5fc41
Last active August 29, 2015 14:05
Benchmark results of the Rust implementations `HashMap` and `PhfMap`
# without optimizations
running 4 tests
test hashmap_find_existing ... bench: 2247 ns/iter (+/- 190)
test hashmap_find_nonexisting ... bench: 1399 ns/iter (+/- 145)
test phf_find_existing ... bench: 1891 ns/iter (+/- 128)
test phf_find_nonexisting ... bench: 1614 ns/iter (+/- 99)
test result: ok. 0 passed; 0 failed; 0 ignored; 4 measured
@vks
vks / hashmap_benchmark.rs
Last active August 29, 2015 14:05
Compare performance of `PhfMap` and `HashMap`.
#![feature(phase)]
extern crate test;
#[phase(plugin)]
extern crate phf_mac;
extern crate phf;
use test::Bencher;
use std::collections::HashMap;
@vks
vks / parallel_add.rs
Last active August 29, 2015 14:01
How to parallelize elementwise vector addition
extern crate sync;
use sync::{Arc, Barrier};
/// Add two vectors elementwise.
/// This is parallelized by dividing them into chunks.
fn elementwise_add<T: Add<T, T> + Send>
(a: &Vec<T>, b: &Vec<T>, chunks: uint) -> Vec<T> {
assert_eq!(a.len(), b.len());
let size = a.len();
@vks
vks / gist:951932
Created May 2, 2011 17:09
1694 test failures
============================= test process starts ==============================
executable: /usr/bin/python2 (2.7.1-final-0)
ground types: gmpy
sympy/assumptions/tests/test_assumptions_2.py[7] ......f [OK]
sympy/assumptions/tests/test_query.py[38] ..ff..................................
[OK]
sympy/assumptions/tests/test_refine.py[3] ... [OK]
sympy/concrete/tests/test_gosper.py[2] .. [OK]
@vks
vks / gist:813452
Created February 6, 2011 15:43
issue 1694 failures
[...]
sympy/printing/pretty/tests/test_pretty.py[24] .......................Error in test 0
at char 2
got u''
ans ''
u' \u221e \n __ \n \\ ` \n ) x\n /_, \nx = 0 '
' oo \n __ \n \\ ` \n ) x\n /_, \nx = 0 '
Error in test 1
at char 2
got u''