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 <iostream> | |
#include <string> | |
#include <memory> | |
template <typename T> | |
union Uninitialized | |
{ | |
Uninitialized() : _initialized() {} | |
~Uninitialized() {} |
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
#ifndef __TOPOSORT_H__ | |
#define __TOPOSORT_H__ | |
#include <unordered_set> | |
#include <functional> | |
#include <memory> | |
#include <vector> | |
#include "RobinHoodHashtable.hpp" |
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 <vector> | |
#include <random> | |
#include <cstddef> | |
#include <functional> | |
#include <unordered_set> | |
template <typename T, typename H = std::hash<T> > | |
struct Hasher | |
{ | |
std::size_t operator()(const T* const pt) const |
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
mode ASSEMBLER | |
{ | |
"iadd" => TKN_IADD; | |
"isub" => TKN_ISUB; | |
"imul" => TKN_IMUL; | |
"idiv" => TKN_IDIV; | |
"imod" => TKN_IMOD; | |
"ineg" => TKN_INEG; |
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 "visitor.hpp" | |
#include <iostream> | |
class OtherTypeAsteroid; | |
class ExplodingAsteroid; | |
class ApolloSpacecraft; | |
class OthersSpacecraft; | |
class SpaceShip {}; | |
class Asteroid : public Visitor<ApolloSpacecraft, OthersSpacecraft>{}; |
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
#ifndef __VISITOR_HPP__ | |
#define __VISITOR_HPP__ | |
template<typename... Types> | |
struct Visitor; | |
template<typename... Visitors> | |
struct Visitable; | |
template<typename T> |
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 <ctime> | |
#include <cstddef> | |
#include <algorithm> | |
#include <iostream> | |
#include "kmeans.hpp" | |
static const std::size_t nPoints = 50000; | |
static const std::size_t nClusters = 100; | |
struct Point |
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
#ifndef __KMEANS_H__ | |
#define __KMEANS_H__ | |
#include <ctime> | |
#include <vector> | |
#include <limits> | |
#include <cstddef> | |
namespace kmeans | |
{ |
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 <queue> | |
#include <cstdlib> | |
#include <iostream> | |
static const int n_log2 = 3; //length of the array log2 | |
static const int n = 1 << n_log2; //length of the array | |
static const int ker = 3; //length of the kernel | |
int abs(int x) | |
{ |