Skip to content

Instantly share code, notes, and snippets.

View fleroviux's full-sized avatar

Mireille fleroviux

View GitHub Profile
@fleroviux
fleroviux / lu-decompose.cpp
Last active August 28, 2020 14:31
LU nxn matrix factorization.
void decompose(float* a, float* l, float* u, int n) {
for (int i = 0; i < n*n; i++) {
l[i] = u[i] = 0;
}
for (int i = 0; i < n; i++) {
l[i*n+i] = 1;
}
for (int i = 0; i < n; i++) { // row index
@fleroviux
fleroviux / make-toolchain.sh
Last active March 9, 2019 20:22
Bash script for compiling a GCC (cross) compiler
#!/bin/sh
# Please install non-optional dependencies noted on this site:
# https://wiki.osdev.org/GCC_Cross-Compiler
# Compiler Configuration
CROSS_TARGET=x86_64-elf
GCC_VERSION="8.1.0" # GCC version
BIN_VERSION="2.30" # Binutils version
@fleroviux
fleroviux / fft512.c
Last active October 31, 2018 21:25
Dead simple & stupid FFT512 implementation in C11
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <complex.h>
#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif
/* Permutation */
#include <stdio.h>
#include <stdint.h>
/*
a mod n = r
a = p * q
p = an+x
q = bn+y
@fleroviux
fleroviux / ansi-colors.c
Created March 19, 2018 14:24
MinGW 32/64 enable ANSI color sequences on Windows 10
// Windows 10 supports ANSI color code sequences, however they need to be enabled
// and apparently MinGW/MinGW-w64 doesn't support set the required STDOUT flag yet. This code enables ANSI VT processing
// on MinGW compilers however it hasn't been tested on older Windows systems yet which do not have that flag.
// So if you use this in production code you probably have to check if the platform is Windows 10.
#include <stdio.h>
#ifdef __MINGW32__
#define NEED_COLOR_FIX
#endif