Skip to content

Instantly share code, notes, and snippets.

View pauljurczak's full-sized avatar

Paul Jurczak pauljurczak

  • USA
View GitHub Profile
@pauljurczak
pauljurczak / main.cpp
Last active September 10, 2015 08:48
Fractional pixel size with Qt
#include <QApplication>
#include <QGraphicsScene>
#include <QLabel>
#include <QBrush>
#include <QGraphicsSimpleTextItem>
#include <QColor>
#include <QGraphicsView>
using namespace std;
static int setIntersectionBenchmark() throws java.io.IOException {
final int nBags = 1000;
final int maxBagLength = 10;
Scanner scanner = new Scanner(new File("10000ran.dat"));
ArrayList<HashSet<Integer>> bags = new ArrayList<HashSet<Integer>>(nBags);
int similarity = 0;
scanner.useDelimiter(",\\s*");
int setIntersectionBenchmark()
{
const int nBags = 1000;
const int maxBagLength = 10;
vector<set<int>> bags;
ifstream input("10000ran.dat"); // http://www.agner.org/random/10000ran.zip
int similarity = 0;
bags.reserve(nBags);
int vectorIntersectionBenchmark()
{
const int nBags = 1000;
const int maxBagLength = 10;
vector<vector<int>> bags;
ifstream input("10000ran.dat"); // http://www.agner.org/random/10000ran.zip
int similarity = 0;
bags.reserve(nBags);
template <typename InIt1, typename InIt2, typename OutIt>
OutIt unordered_set_intersection(InIt1 b1, InIt1 e1, InIt2 b2, InIt2 e2, OutIt out) {
while (!(b1 == e1)) {
if (!(std::find(b2, e2, *b1) == e2)) {
*out = *b1;
++out;
}
++b1;
}
int vectorIntersectionBenchmarkLoopOpt1()
{
const int nBags = 1000;
const int maxBagLength = 10;
vector<vector<int>> bags;
ifstream input("10000ran.dat"); // http://www.agner.org/random/10000ran.zip
int similarity = 0;
bags.reserve(nBags);
int setIntersectionBenchmarkLoopOpt1()
{
const int nBags = 1000;
const int maxBagLength = 10;
vector<set<int>> bags;
ifstream input("10000ran.dat"); // http://www.agner.org/random/10000ran.zip
int similarity = 0;
bags.reserve(nBags);
162 required packages:
- ASTInterpreter 0.0.4
- AbstractTrees 0.0.4
- ArgParse 0.5.0
- Atom 0.5.10
- AutoGrad 0.0.6
- AutoHashEquals 0.1.1
- AxisAlgorithms 0.1.6
- BinDeps 0.5.0
- Blink 0.5.2