Skip to content

Instantly share code, notes, and snippets.

View MurageKibicho's full-sized avatar
🛼
Working from home

Murage Kibicho MurageKibicho

🛼
Working from home
  • Yale University
  • New Haven, Connnecticut
  • 23:58 (UTC -04:00)
View GitHub Profile
@MurageKibicho
MurageKibicho / Float2Rational.c
Created April 10, 2025 23:10
FloatToRational
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdint.h>
#include <gmp.h>
#define m32_ENABLE_ERRORS 1
#define m32_TRUE 1
#define m32_FALSE 0
#define PRINT_ERROR(msg) \
do { \
#include <stdio.h>
#include <stdlib.h>
void BinaryToSternBrocotFraction(int binaryLength, int *binary)
{
/*
Create the 2*2 identity matrix
|1 0| is the matrix {1, 0, 0, 1}
|0 1|
@MurageKibicho
MurageKibicho / Brocot-2.c
Created March 28, 2025 14:34
C program to convert a Binary Sequence to a fraction on the Stern Brocot tree
#include <stdio.h>
#include <stdlib.h>
void BinaryToSternBrocotFraction(int binaryLength, int * binary) {
/*
Create the 2*2 identity matrix
|1 0| is the matrix {1, 0, 0, 1}
|0 1|
@MurageKibicho
MurageKibicho / LeetArxiv.html
Created March 28, 2025 10:43
LeetArxiv Journal Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Asymptotically Fast Factorization</title>
<style>
body {
font-family: "Times New Roman", Times, serif;
max-width: 800px;
@MurageKibicho
MurageKibicho / GPT2-2.c
Created March 28, 2025 02:53
GPT2-C Part 2 31:23 minute mark before adding for loop
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include <sys/mman.h>
#include <stdbool.h>
#include "cJSON.h"
#define VOCABULARY_SIZE 50257
@MurageKibicho
MurageKibicho / GPT2_1.c
Created March 27, 2025 19:29
Got to attention, just before creating function at 6.14.13
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include <sys/mman.h>
#include <stdbool.h>
#include "cJSON.h"
#define VOCABULARY_SIZE 50257
@MurageKibicho
MurageKibicho / gpt.c
Created March 27, 2025 13:08
GPT in C before cahing safe tensors loading
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/mman.h>
#include "cJSON.h"
#define VOCABULARY_SIZE 50257
#define tf_d_vocab 50257
#define tf_d_seq 1024
@MurageKibicho
MurageKibicho / Diffusion.c
Created March 22, 2025 03:48
Forward step Diffusion
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
#define PI 3.14159265358979323846
#define MIN_BETA 0.0001
#define MAX_BETA 0.9999
float DiffusionInternalSigmoid(float x)
@MurageKibicho
MurageKibicho / gist:b6520c6f66325fe13f6de47cd35e3454
Created March 21, 2025 17:52
Noise Schedules for Diffusion Models in C
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
#define PI 3.14159265358979323846
#define MIN_BETA 0.0001
#define MAX_BETA 0.9999
float DiffusionInternalSigmoid(float x)
@MurageKibicho
MurageKibicho / Posit.c
Created March 20, 2025 12:20
Signed Residue number system
#ifndef _FFASM_H_
#define _FFASM_H_
#ifndef ff_BITS
#define ff_BITS 32
#endif
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>