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 <array> | |
#include <iostream> | |
#include <vector> | |
template <typename T, | |
// Number of dimensions of tensor. | |
int D> | |
class Tensor { | |
public: | |
template <typename... T2, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 tensorflow as tf | |
from scipy.optimize import minimize | |
import matplotlib | |
matplotlib.use('PDF') | |
import matplotlib.pyplot as plt | |
# Generate dataset | |
data = np.random.normal(0, 1, 1000) |
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 tensorflow as tf | |
sess = tf.Session() | |
TYPE=np.float64 | |
N = 1000000 | |
data = np.random.normal(0, 1, N).astype(TYPE) |
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 __future__ import print_function | |
import gevent | |
import gevent.queue | |
import gevent.pool | |
import gevent.subprocess | |
import gevent.monkey | |
gevent.monkey.patch_all() |
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
merge [] ys = ys | |
merge xs [] = xs | |
merge xs@(x:xt) ys@(y:yt) | x <= y = x : merge xt ys | |
| otherwise = y : merge xs yt | |
mergeLists [] = [] | |
mergeLists [x] = [x] | |
mergeLists (x:y:rest) = mergeLists $ (merge x y) : mergeLists rest | |
ll = [[1,2,3], [1,3,6], [1, 10], [3,3,3], [1], [1,1,1,5]] |
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
def get_matching_variables(fname, tree, patterns): | |
from fnmatch import fnmatch | |
from root_numpy import list_branches | |
branches = list_branches(fname, tree) | |
selected = [] | |
for p in patterns: | |
for b in branches: |
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 | |
# normal ordering values from NuFit 2.0, JHEP 11 (2014) 052 [arXiv:1409.5439] | |
θ_12 = np.deg2rad(33.48) | |
θ_23 = np.deg2rad(42.3) | |
θ_13 = np.deg2rad(8.50) | |
δ_CP = np.deg2rad(306) | |
Δm21 = np.sqrt(7.50e-5) # eV^2 | |
Δm31 = np.sqrt(2.449e-3) # eV^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
#ifndef ENUMS_H | |
#define ENUMS_H | |
#include <boost/preprocessor.hpp> | |
#include <string> | |
/* | |
* The following macros allow you to define an enum and get `toString` | |
* and `fromString` functions generated automatically. | |
* If you use |
NewerOlder