Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Daniel Kohlsdorf dkohlsdorf

🏠
Working from home
View GitHub Profile
View Merko.txt
,~~+++===~:,,,,
,,:=+==~~~=~========::,
,:++?=~::~~~~~~~~~~=~====:,
,::=?+=~~~~~~~~::::::::~~~~~~~~==~:
,,:=?+?=~~~~~:~~~~~~::::::::::::::~====~:,
:++???=~~~::::~:~~~::,,,,,,,,,:::,::::~~=++~,
,~+++===~~:::::::::::,,,,,,,,,,,,,,,,:::~~==?=,
, ,+?+==~~::::::::::,,,,,,,..........,,,,,,~~~==?=,
=~?+???=~::::::,,,,,,,,,,,,..............,,~~=+??+=:
+++=+====~:::::,,,,,,,,,,,,,...............,,,,~++===+:
@dkohlsdorf
dkohlsdorf / Alignment.scala
Last active May 26, 2017
General Sequence Alignment
View Alignment.scala
class Alignment[A](
init: (Int, Int) => Double,
rank: (Double, Double, Double, A, A) => Double
) {
def score(x: Array[A], y: Array[A]): Double = {
val n = x.size
val m = y.size
val dp = Array.ofDim[Double](n + 1, m + 1)
View InfiniteCalm.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dkohlsdorf
dkohlsdorf / UnionFind.java
Created Jun 27, 2018
Union Find Data Structure
View UnionFind.java
public class UnionFind {
private int id[];
private int count;
public UnionFind(int N) {
count = N;
id = new int[N];
for(int i = 0; i < N; i++) {
@dkohlsdorf
dkohlsdorf / iSax.py
Created Aug 16, 2018
Simple iSAX Implementation
View iSax.py
import numpy as np
import scipy.stats as stats
def generate_split(n_char, mu = 0.0, std = 1.0):
return stats.norm.ppf(np.arange(1, n_char) / n_char, mu, std)
def convert(x, splits, cardinality):
n = len(x)
chars = np.zeros(n, dtype=np.int)
for i in range(0, n):
@dkohlsdorf
dkohlsdorf / Audio Interest Point
Created Apr 1, 2015
Extract Local Interest Points from a spectrogram
View Audio Interest Point
package processing.signals;
import java.util.ArrayList;
/**
* Extract all local features from current spectrogram
*
* @author Daniel Kohlsdorf
*/
public class LocalFeatureExtractor {
@dkohlsdorf
dkohlsdorf / BitSet.java
Last active Mar 13, 2019
Implements a set on an integer
View BitSet.java
public class BitSet {
private int set = 0;
public void add(int position) {
int mask = 1 << position;
set = set | mask;
}
View Heap.java
import java.util.Arrays;
/**
* Implements a size limited heap
*
* @author Daniel Kohlsdorf
*/
public class Heap {
private double heap[];
@dkohlsdorf
dkohlsdorf / Merge.java
Last active Mar 13, 2019
Merge As In Mergesort
View Merge.java
import java.util.Arrays;
/**
* Merge as in MergeSort
*
* @author Daniel Kohlsdorf
*/
public class Merge {
public static int[] merge(int x[], int y[]) {
@dkohlsdorf
dkohlsdorf / KMeans.java
Last active Mar 13, 2019
K Means Clustering
View KMeans.java
import java.util.Random;
public class KMeans {
public static double distance(double x[], double y[]) {
int D = x.length;
double distance = 0;
for(int i = 0; i < D; i++) {
distance += Math.pow(x[i] - y[i], 2);
You can’t perform that action at this time.