Skip to content

Instantly share code, notes, and snippets.

# imports
import BBP
import numpy
import random
import time
import wx
from math import pi, sqrt, log10
from deap import base
from deap import creator
from deap import tools
#include <stdio.h>
#include <omp.h>
int main(int argc, char *argv[]) {
const int N = 1000;
unsigned int i, a[N+10];
unsigned int j;
for (j = 0; j < 100; j++) {
#pragma omp parallel for num_threads(4)
import operator
import math
import random
import ctypes
from functools import reduce
import numpy
from deap import algorithms
from deap import base
@soravux
soravux / approx_invsqrt.py
Last active August 29, 2015 13:57
Code for multigrad blog entry about math hack tricks
# Mostly stolen from deap's symbreg GP example
import operator
import math
import random
import string
import inspect
import ctypes
import numpy
from scipy import optimize
#include "simpleCL.h"
int main() {
char buf[]="Hello, World!";
size_t global_size[2], local_size[2];
int found, worksize;
sclHard hardware;
sclSoft software;
// Target buffer just so we show we got the data from OpenCL
__kernel void example( __global char* buf, __global char* buf2 ){
int x = get_global_id(0);
buf2[x] = buf[x];
}
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
@soravux
soravux / opencv_hdr_libexif.cpp
Created April 11, 2014 13:38
HDR using OpenCV with libexif
#include <libexif/exif-data.h>
#include <opencv2/photo.hpp>
#include <opencv2/highgui.hpp>
#include <vector>
#include <iostream>
#include <fstream>
#include <dirent.h>
using namespace cv;
using namespace std;
"""
File name: gp_from_string_fix.py
Author: Thomas Macrina
Date created: 04/15/2014
Python Version: 2.7
Simple DEAP strongly-typed GP setup to demonstrate
difficulties with ephemerals and scoop.
"""
@soravux
soravux / tdd_notes.md
Last active August 29, 2015 14:00 — forked from gelendir/tdd_notes.md
Propositions de modifications au plan de TDD

commands

beginner

  • echo
  • date
  • sleep
  • mkdir