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
/** | |
* \brief Online algorithm to compute the mean and variance. | |
* Source: http://datagenetics.com/blog/november22017/index.html | |
*/ | |
class MeanVariance | |
{ | |
int64_t n_ = 0; | |
double mean_ = 0; | |
double sn_ = 0; | |
double lastmean_ = 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
#include <vector> | |
#include <random> | |
#include <cstdio> | |
#include <optional> | |
#include <algorithm> | |
#include <cassert> | |
#include <chrono> | |
#include <functional> | |
typedef double real; //using doubles in the test case |
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
""" | |
A small GUI that loads a number of images and allows to display a "lens" of a certain area. | |
Used to highlight important areas in comparison images. | |
""" | |
import math | |
import os | |
import numpy as np | |
import cv2 as cv | |
import imageio |
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
""" | |
Multigrid-Test for the 2D poisson problem | |
with arbitrary Dirichlet boundaries over the domain and Neumann boundaries at the border. | |
Based on the tutorial from http://www.mgnet.org/mgnet/tutorials/xwb/example.html | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def generateProblem1(size : int): |
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
class MeanVariance(): | |
""" | |
Online algorithm to compute the mean and variance | |
Source: http://datagenetics.com/blog/november22017/index.html | |
""" | |
def __init__(self): | |
self.n_ = 0 | |
self.mean_ = 0 | |
self.sn_ = 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
#pragma once | |
#include <ThreadPool.h> //https://github.com/mtrebi/thread-pool | |
#include <assert.h> | |
#include <iostream> //Only for logging, can be replaced by something else | |
/** | |
* \brief Improved background worker that reuses the thread. | |
* Can only be allocated on the heap | |
*/ |
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
#pragma once | |
#include <corecrt.h> | |
_CRT_BEGIN_C_HEADER | |
#ifdef release_assert | |
#undef release_assert | |
#endif | |
_ACRTIMP void __cdecl _wassert( |
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 <numeric> | |
/** | |
* Computes the i-th entry of the halton sequence of size N. | |
* Code copied from somewhere (I don't remember) and then modernized to use std::array. | |
*/ | |
template<int N> | |
std::array<double, N> halton(int i) | |
{ | |
static_assert(N <= 168, "halton sequence only supported until dimension 168"); |
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 "cuPrintf.cuh" | |
#include <device_launch_parameters.h> | |
#include "cuMat/src/Errors.h" | |
// This structure is used internally to track block/thread output restrictions. | |
typedef struct __align__(8) { | |
int threadid; // CUPRINTF_UNRESTRICTED for unrestricted | |
int blockid; // CUPRINTF_UNRESTRICTED for unrestricted | |
} cuPrintfRestriction; |