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
#include <iostream> | |
#include <vector> | |
#include <set> | |
using namespace std; | |
using Pair = vector<int>; | |
using Pairs = vector<Pair>; | |
bool should_join(Pair p1, Pair p2){ | |
for (int n1 : p1){ |
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
import numpy as np | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
fig = plt.figure() | |
ax = fig.add_subplot(111, projection='3d') | |
b1 = np.array([ | |
[1, 0, 0], | |
[0, 1, 0], |
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
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.pyplot import plot, scatter, imshow | |
from mpl_toolkits.mplot3d import Axes3D | |
N = 1000 | |
z = np.random.uniform(-1, 1, N) | |
phi = np.random.uniform(-np.pi, np.pi, N) | |
rxy = np.sqrt(1 - z**2) |
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
#include <iostream> | |
#include <fstream> | |
#include <regex> | |
#include <string> | |
using XYZ = std::array<double, 3>; | |
using Coord3D = std::vector<XYZ>; | |
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
from time import time | |
import numpy as np | |
from numba import njit, prange | |
@njit(parallel=True) | |
def ndot1(A, B): | |
""" | |
Calculate C with | |
C[i, j, k] = sum_q( A[i, j, q] · B[i, q, 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
#!/usr/bin/env python3 | |
import math | |
from itertools import product | |
import numpy as np | |
from numba import njit | |
from numba.typed import List | |
@njit | |
def build_verlet_nlist(nlist: List, point: List, particles: np.ndarray, rl:float): |
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
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy import ndimage | |
from matplotlib.pyplot import plot, scatter, imshow | |
def get_fake(size, number, radius, blur): | |
""" | |
Generate a fake image for ideal gas (random positions). | |
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
./configure --with-features=huge \ | |
--enable-multibyte \ | |
--enable-rubyinterp=yes \ | |
--enable-python3interp=yes \ | |
--with-python3-config-dir=$(python3-config --configdir) \ | |
--enable-perlinterp=yes \ | |
--enable-luainterp=yes \ | |
--enable-cscope \ | |
--prefix=/usr/local |
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
#!/usr/bin/env python | |
import re | |
import sys | |
from textwrap import dedent | |
STOPWORDS = [ # common stop words from package nltk | |
"i", "me", "my", "myself", "we", "our", "ours", "ourselves", "you", "you're", "you've", "you'll", | |
"you'd", "your", "yours", "yourself", "yourselves", "he", "him", "his", "himself", "she", "she's", | |
"her", "hers", "herself", "it", "it's", "its", "itself", "they", "them", "their", "theirs", | |
"themselves", "what", "which", "who", "whom", "this", "that", "that'll", "these", "those", "am", |
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
ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /usr/local/include/X11 | |
./configure\ | |
--enable-optimizations\ | |
--prefix=/usr/local\ | |
--enable-shared\ | |
--with-openssl=$(brew --prefix openssl)\ | |
CPPFLAGS="-I/usr/local/opt/openssl/include"\ | |
LDFLAGS="-L/usr/local/opt/openssl/lib" |