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
{ | |
function getTerms(t, ts) { | |
if (t) { | |
var arr = []; | |
for (var i = 0; i < ts.length; ++i) { | |
arr.push(ts[i][2]); | |
} | |
return [t].concat(arr); | |
} | |
return []; |
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
#define USE_ROBIN_HOOD_HASH 1 | |
#define USE_SEPARATE_HASH_ARRAY 1 | |
template<class Key, class Value> | |
class hash_table | |
{ | |
static const int INITIAL_SIZE = 256; | |
static const int LOAD_FACTOR_PERCENT = 90; | |
struct elem |
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 <map> | |
#include <unordered_map> | |
template<typename Key, typename Value> | |
using stdmap = std::map<Key, Value>; | |
template<typename Key, typename Value> | |
using stdumap = std::unordered_map<Key, Value>; |
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
// With gcc 7+ or clang 5+, compiles with -std=c++17 flag | |
#include <iostream> | |
#include <memory> | |
#include <vector> | |
// Base class for gates: | |
struct gate { | |
virtual void apply(std::vector<bool>& bits) const = 0; | |
virtual std::ostream& print(std::ostream&) const = 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
// With gcc 7+ or clang 5+, compiles with -std=c++17 flag | |
#include <iostream> | |
#include <variant> | |
#include <vector> | |
struct toffoli_gate { | |
uint32_t c0, c1, x; | |
toffoli_gate(uint32_t c0_, uint32_t c1_, uint32_t x_) noexcept | |
: c0(c0_), c1(c1_), x(x_) { |
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
// tslint:disable | |
/* | |
* Generated by PEG.js 0.10.0. | |
* | |
* http://pegjs.org/ | |
*/ | |
"use strict"; | |
function peg$subclass(child, parent) { |
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
// C++17 | |
#include <iostream> | |
#include <array> | |
#include <initializer_list> | |
// Column-major matrix based on std::array. | |
template<size_t ROW, size_t COL, typename T> | |
class matrix { | |
public: |
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
Codon size: 100 | |
0: dS/dt = a\ndI/dt = I\ndR/dt = S | |
1: dS/dt = S - S - b * S - a\ndI/dt = S * I - I - a * S * a * -I * b - I * a * S * a * b * a - I - a\ndR/dt = --a - --I - a * b * -a * ---S - S * a * a - a * a | |
4: dS/dt = -a - I - b\ndI/dt = S - b - --b - a * -b * a * b - S - S - I\ndR/dt = a * a * S * b - I | |
7: dS/dt = a\ndI/dt = S * a\ndR/dt = b - I | |
9: dS/dt = b * S * S\ndI/dt = I * I - b * S * a\ndR/dt = -b - I - b * S - S * S * a * b | |
12: dS/dt = I * b * S\ndI/dt = -a - I - a * a - S\ndR/dt = S * S * b * -S - S - -S - a - -b - -a - b - a - b - S - S * I - ---b - a - S * S - I * b * S - -a - I - a * a - a * I - b * S * b * -S - S - -S - a - -b - -a - b - a - b - S | |
15: dS/dt = -I - S\ndI/dt = --a - -b - b\ndR/dt = -a - b - S * b - a - S * -S * -b - S | |
16: dS/dt = a * b\ndI/dt = -b * b\ndR/dt = b - I - a * b - a * I | |
17: dS/dt = I * I * a - I\ndI/dt = a * a - -S - ----S - -a * --b - b - S * I - a * b - a\ndR/dt = S - a |
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
<expr> ::= dS/dt = <formula>\ndI/dt = <formula>\ndR/dt = <formula> | |
<formula> ::= <unary><formula> | <formula> <operator> <formula> | <formula> <operator> <variable> | <variable> <operator> <formula> | <variable> | |
<unary> ::= - | |
<operator> ::= - | * | |
<variable> ::= a | b | I | 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
/** | |
* @file grammatical_evolution.h | |
* @brief Functions to use grammatical evolution to evolve programs, mathematical | |
* functions, sentences, whatever you want, just use your imagination! | |
*/ | |
#ifndef RAW_GRAMMATICAL_EVOLUTION_H_ | |
#define RAW_GRAMMATICAL_EVOLUTION_H_ | |
#include "raw/common.h" | |
#include "raw/grammar.h" |