Skip to content

Instantly share code, notes, and snippets.

void DWT::transform1d(float *src, int length, int step)
{
float *tmp = new float[length];
float W = 1/sqrt(2.0f);
for (int len = length/2; len >= PREVIEW; len /= 2) {
for (int i = 0; i < len; i++) {
float c = src[i*2*step];
float w = src[(i*2+1)*step];
tmp[i] = (c+w)*W;
tmp[i+len] = (c-w)*W;
/**
* Builds a new sudoku instance given a difficulty level
*
* @param level describes the difficulty level of the generated game
* - 1 normal
* - 2 medium
* - 3 hard
*/
def makeSudoku(level: Int): Sudoku = {
var board = new Array[Array[Int]](9, 9)
using System;
namespace Stack
{
public class StackEmpty : Exception { }
public class Stack
{
private object[] arr;
using System;
using System.Diagnostics.Contracts;
namespace Stack
{
public class StackEmpty : Exception { }
public class Stack
{
private object[] arr;
@hoheinzollern
hoheinzollern / sample_contracts.py
Created November 13, 2010 02:16
This is what the result should be
@invariant(lambda self: self.value >= 0)
class PositiveInt(object):
@post(lambda self: self.num_changes == 0 and self.value == 0)
def __init__(self):
self.value = 0
self.num_changes = 0
@post(lambda new, old: new.num_changes == old.num_changes + 1)
def add(self, x):
self.value += x
#include "hg_adv.h"
#define ADV_DEBUG 0
VgHashTable write_buffers_8;
VgHashTable write_buffers_16;
VgHashTable write_buffers_32;
VgHashTable write_buffers_64;
typedef struct _AddrWBNode {
%% instance
place(1).
place(2).
place(3).
place(4).
transition(1).
transition(2).
t_pre(1,1).
t_post(1,2).
from copy import deepcopy
from pprint import pprint
board = [
[-1,-1, 1, 1, 1,-1,-1],
[-1,-1, 1, 1, 1,-1,-1],
[ 1, 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 0, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1, 1],
[-1,-1, 1, 1, 1,-1,-1],
@hoheinzollern
hoheinzollern / gist:4223830
Created December 6, 2012 11:29
Eclipse configuration
*** Date: Thursday, December 6, 2012 12:29:19 PM Central European Time
*** Platform Details:
*** System properties:
applicationXMI=org.eclipse.ui.workbench/LegacyIDE.e4xmi
awt.nativeDoubleBuffering=true
awt.toolkit=apple.awt.CToolkit
eclipse.application=org.eclipse.ui.ide.workbench
eclipse.buildId=M20120914-1800
*** Date: Friday, December 7, 2012 10:25:15 AM Central European Time
*** Platform Details:
*** System properties:
awt.nativeDoubleBuffering=true
awt.toolkit=apple.awt.CToolkit
eclipse.application=org.eclipse.ui.ide.workbench
eclipse.buildId=M20120208-0800
eclipse.commands=-os