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
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; |
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
/** | |
* 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) |
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 System; | |
namespace Stack | |
{ | |
public class StackEmpty : Exception { } | |
public class Stack | |
{ | |
private object[] arr; |
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 System; | |
using System.Diagnostics.Contracts; | |
namespace Stack | |
{ | |
public class StackEmpty : Exception { } | |
public class Stack | |
{ | |
private object[] arr; |
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
@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 |
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
sealed abstract class Tree[A] | |
case class Item[A] (item: A) extends Tree[A] | |
case class Section[A] (s: List[Tree[A]]) extends Tree[A] | |
sealed abstract class Path[A] | |
case class Top[A] extends Path[A] | |
case class Node[A] (l: List[Tree[A]], p: Path[A], r: List[Tree[A]]) extends Path[A] | |
case class Location[A] (t: Tree[A], p: Path[A]) |
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 "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 { |
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
from django.contrib import admin | |
class SlaveInline(admin.TabularInline): | |
model = Slave | |
extra = 0 | |
class MasterAdmin(admin.ModelAdmin): | |
inlines = (SlaveInline,) | |
class Media: |
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
%% instance | |
place(1). | |
place(2). | |
place(3). | |
place(4). | |
transition(1). | |
transition(2). | |
t_pre(1,1). | |
t_post(1,2). |
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
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], |
OlderNewer