This file contains hidden or 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
cpdef rectangle(np.ndarray[double, ndim=3, mode="c"] boxes, | |
np.ndarray[double, ndim=2, mode="c"] points): | |
#as input we have 2 arrays, one with the boxes cartesian coords | |
#the other with points cartesian coords (2D) | |
#mode C ensure you have a one D array | |
#boxes and points generated in python | |
#now we need C to compute the number of points within the rectangle | |
#transform into memory view the arrays | |
B, M = boxes.shape[0], boxes.shape[1]*2 #B number of rectangles, M rect coords | |
N, y = points.shape[0], points.shape[1] |
This file contains hidden or 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
all: | |
cython rect_in.pyx | |
gcc -g -O3 -fpic -c rect_in.c `python-config --cflags` -std=c99 | |
gcc rect_in.o -o rect_in.so -shared `python-config --ldflags` -std=c99 |
This file contains hidden or 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
double kendalT(double *x, int len_x, double * y, int len_y) | |
{ | |
//the two array MUST be have the same length | |
int n2=0, n1=0, k, j; | |
int is =0; | |
double aa, a2, a1; | |
for(j=1;j<len_x;j++){ | |
for(k=(j+1);k<=len_x;k++){ | |
a1=x[j]-x[k]; |
This file contains hidden or 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
# values | Cython | Python | |
---|---|---|---|
100 | 0.01 s | 0.01 s | |
10k | 0.16 s | 0.80 s | |
100k | 27.89 | 10.22 s |
This file contains hidden or 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
Phase | Process | Analysis | No Subsampling | Subsampling | |
---|---|---|---|---|---|
Bound | Discharge | MBAR | -51.99 | -51.95 | |
Bound | Discharge | TI | -51.97 | -52.11 | |
Bound | Vanish | MBAR | -3.39 | -30.80 | |
Bound | Vanish | TI | -17.32 | -10.06 | |
Free | Discharge | MBAR | -62.63 | -62.65 | |
Free | Discharge | TI | -62.60 | -62.54 | |
Free | Vanish | MBAR | -37.74 | -40.13 | |
Free | Vanish | TI | -39.67 | -40.44 | |