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
\usepackage[subsection]{algorithm} % algorithm float, number according to subsection | |
\usepackage{algpseudocode} % pseudo-code format | |
\begin{algorithm}[htbp] | |
\caption{Parallel CUDA algorithm for connect component labelling \#1} | |
\label{alg:imageLabellingGPU1} | |
\algblockdefx[kernel]{Kernel}{EndKernel}[2][default value]{{\bf kernel} {\footnotesize \uppercase{#1}(#2)}}{\bf end kernel} | |
\begin{algorithmic} |
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
# http://stackoverflow.com/questions/19120489/compare-two-files-report-difference-in-python | |
import difflib | |
import sys | |
with open('transect_2_night_1.bin_PB_2013-09-13_151717.dat', 'r') as hosts0: | |
with open('transect_3_day_1.bin_PB_2013-09-13_150838.dat', 'r') as hosts1: | |
diff = difflib.unified_diff( | |
hosts0.readlines(), | |
hosts1.readlines(), | |
fromfile='hosts0', |
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
origin='Madison,Chicago,IL'; | |
destination='N+Michigan+Ave,Chicago,IL'; | |
url1=['https://maps.googleapis.com/maps/api/directions/json?origin=' origin '&destination=' destination '&sensor=false&key= XXXX&departure_time=1343641500&mode=driving']; | |
direction=urlread(url1); | |
d=parse_json(direction); | |
steps=d{1}.routes{1}.legs{1}.steps; | |
[startpoints,endpoints]=cellfun(@parsecoord,steps); | |
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
Sub outputfile_whole() | |
Dim Infilename, outfilename As String | |
Dim name As String | |
Filename = ThisWorkbook.FullName | |
filename1 = ThisWorkbook.name | |
filename1 = Left(filename1, Len(filename1) - 5) |
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
import numpy as np | |
from scipy.io.wavfile import read,write | |
import matplotlib.pyplot as plt | |
from matplotlib.pylab import * | |
def omega(N,k,n): | |
return np.exp(-2*np.pi/N*k*n*1j) | |
def hanWindow(N): | |
diag=np.array([np.sin(np.pi*i/(N-1))**2 for i in range(N)]) |
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
// This code is from https://www.cac.cornell.edu/VW/OpenMP/whileloop.aspx | |
#include <omp.h> | |
#include <stdio.h> | |
int main(int argc, char **argv) | |
{ | |
/* OpenMP does not provide a parallel while loop, | |
so we're going to have to make one ourselves... */ | |
int sj, sstop, tn, tj, tstop; | |
int foo(int j); |
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
# http://stackoverflow.com/questions/10628847/geom-boxplot-with-precomputed-values | |
library(ggplot2) | |
DF <- data.frame(x=c("A","B"), min=c(1,2), low=c(2,3), mid=c(3,4), top=c(4,5), max=c(5,6)) | |
ggplot(DF, aes(x=x, ymin = min, lower = low, middle = mid, upper = top, ymax = max)) + | |
geom_boxplot(stat = "identity") |
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 <iostream> | |
using namespace std; | |
struct person{ | |
person * previousPerson; | |
person * nextPerson; | |
int sword; | |
int num; | |
}; |
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
import urllib2; | |
import numpy as np; | |
import json; | |
from pyproj import Geod; | |
def decode_line(encoded): | |
"""copied from https://github.com/jconst/Byway-Server/blob/master/polyline.py | |
""" | |
encoded_len = len(encoded) |
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
#### LDA,QDA, RDA, naive baye functions #### | |
lda.model=function(traindata){ | |
lda.result=lda(Y~.,data=traindata) | |
return(lda.result) | |
} | |
lda.pred=function(model,dataSets.X){ | |
predresult=lapply(dataSets.X,function(X) predict(model,X)$class) | |
errorInfo(predresult,"lda") |
OlderNewer