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 <cmath> | |
#include <stdint.h> | |
#include <stdio.h> | |
// | idx | mae | description | | |
// |-----|----------|-------------------| | |
// | 0 | 1.008427 | Naiive with k0=0 | | |
// | 1 | 0.144398 | Original Quake | | |
// | 2 | 0.099314 | Our grad descent | | |
// | 3 | 0.060105 | Jan Kadlec (wiki) | |
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
#pragma once | |
#include <assert.h> | |
#include <cstddef> | |
#include <new> | |
#include <type_traits> | |
// C++17 aligned allocator | |
// Sources: https://en.cppreference.com/w/cpp/named_req/Allocator | |
// https://en.cppreference.com/w/cpp/memory/allocator_traits |
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
// Compiling with clang or gcc | |
// clang main.cpp -o main -march=native -O3 -ffast-math -Wextra -Werror -Wunused-parameter -lm | |
// Use "-march=native -ffast-math -O3" for faster gradient descent | |
// Use "-lm" if linking to glibc math libraries on Linux | |
// Remove "-W*" warning flags if you don't need checks | |
#define _USE_MATH_DEFINES | |
#include <stdio.h> | |
#include <cmath> | |
#include <vector> |