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
#!/usr/bin/python | |
# coding: UTF-8 | |
import time | |
import numpy as np | |
from numpy.fft import fft, ifft | |
from numpy.random import random_sample | |
from alsaaudio import PCM, PCM_NONBLOCK, PCM_FORMAT_FLOAT_LE | |
C_freq = np.float128(440) | |
magic = 2 ** (1/12.) |
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 <stdio.h> | |
# include <math.h> | |
# include "emd.h" | |
/* 欧几里得距离 */ | |
float dist(feature_t *F1, feature_t *F2) { | |
int dX = F1->X - F2->X; | |
int dY = F1->Y - F2->Y; | |
int dZ = F1->Z - F2->Z; | |
return sqrt(dXdX + dY*dY + dZ*dZ); |
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
library(lpSolve) | |
# 欧几里得距离 | |
euclid_dist <- function(f1, f2) { | |
return(sqrt(sum((f1 - f2)^2))) | |
} | |
# 计算EMD | |
emd <- function(dist, w1, w2) { | |
# 准备lp.transport()参数 |
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
#coding:utf-8 | |
import numpy as np | |
import rpy2.robjects as robjects | |
# 从R中导入lp.transport() | |
robjects.r['library']('lpSolve') | |
transport = robjects.r['lp.transport'] | |
def euclid_dist(feature1, feature2): | |
"""计算欧氏距离""" |
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
# *.google.com 笛卡尔集 | |
203.208.45.193 | |
203.208.45.195 | |
203.208.45.196 | |
203.208.45.200 | |
203.208.45.192 | |
203.208.45.201 | |
203.208.45.202 | |
203.208.45.197 | |
203.208.45.203 |
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
203.208.46.143 rimeime.googlecode.com | |
#google plus game | |
203.208.46.143 newsfeed-dot-latest-dot-rovio-ad-engine.appspot.com | |
203.208.46.143 project-slingshot-gp.appspot.com | |
203.208.46.143 r2303.latest.project-slingshot-hr.appspot.com | |
203.208.46.143 r3115-dot-latest-dot-project-slingshot-gp.appspot.com | |
203.208.46.143 r3138-dot-latest-dot-project-slingshot-gp.appspot.com | |
203.208.46.143 r3232-dot-latest-dot-project-slingshot-gp.appspot.com | |
203.208.46.143 r3269-dot-latest-dot-project-slingshot-gp.appspot.com | |
203.208.46.143 ct-google.crimecitygame.com |
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
#!/usr/bin/python | |
__doc__ = """Tiny HTTP Proxy. | |
This module implements GET, HEAD, POST, PUT and DELETE methods | |
on BaseHTTPServer, and behaves as an HTTP proxy. The CONNECT | |
method is also implemented experimentally, but has not been | |
tested yet. | |
Any help will be greatly appreciated. SUZUKI Hisao |
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
/** | |
* @class CheckerBoard | |
* | |
* the result is expected to be: | |
* # # # # | |
* # # # | |
* # # # # | |
* # # # | |
* # # # # | |
* # # # |
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
[x,y,z]=meshgrid(linspace(-3,3,120)); | |
f=(x.^2 + (5/2)*y.^2 + z.^2 - 1).^3 - (1/16)\*y.^2.\*z.^3 - x.^2.*z.^3; | |
[f1,v]=isosurface(x,y,z,f,0); | |
%newplot; | |
p=patch('Faces',f1,'Vertices',v,'CData',v(:,3),'facecolor','flat','EdgeColor','k'); | |
isonormals(x,y,z,f,p); | |
view(3); | |
axis equal; | |
grid on; | |
set(p,'AmbientStrength',.6); |
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
for a=0:112; | |
for b=0:60; | |
u=a/2; | |
w=b/2; | |
v=w/50-0.3; | |
X(a+1,b+1)=cos(u)+v\*cos(u/2)\*cos(u); | |
Y(a+1,b+1)=sin(u)+v\*cos(u/2)\*sin(u); | |
Z(a+1,b+1)=v*sin(u/2); | |
T(a+1,b+1)=u; | |
end |