Skip to content

Instantly share code, notes, and snippets.


Aidan Rocke AidanRocke

View GitHub Profile
View fx.c
#include "fx.h"
#include <stddef.h>
#include <stdint.h>
#include <math.h>
#include <assert.h>
void static inline wht_butterfly(float * const s, float * const d) {
float temp = *s;
*s += *d;
*d = temp - *d;
kingjr /
Created Jun 8, 2018
Find simplest google translate request that generate the maximum number of unique words
from googletrans import Translator
from itertools import product
from pandas import DataFrame, read_csv
import numpy as np
import string
import time
import os
# Get google translator object
translator = Translator()
higham / complex_step_example.m
Last active Oct 21, 2020
Complex step example
View complex_step_example.m
% Complex step example. Requires Symbolic Math Toolbox.
format long
syms x; f = atan(x)/(1+exp(-x^2))
% Derivative at $a = 2$:
a = 2; fd = double(subs( diff(f), a))
% Convert symbolic function to MATLAB function.
f = matlabFunction(f);
higham / complex_step.m
Created Apr 21, 2018
Complex step approximation to derivative.
View complex_step.m
function fd = complex_step(f,x,h)
%COMPLEX_STEP Complex step approximation to derivative.
% fd = COMPLEX_STEP(f,x,h) computes the complex step approximation
% fd to the derivative of f at x, using step h (default 1e-100).
if nargin < 3, h = 1e-100; end
fd = imag( f(x + sqrt(-1)*h) )/h;
# Working example for my blog post at:
import functools
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def doublewrap(function):
A decorator decorator, allowing to use the decorator to be used without
rossant /
Last active Apr 16, 2021
Very simple ray tracing engine in (almost) pure Python. Depends on NumPy and Matplotlib. Diffuse and specular lighting, simple shadows, reflections, no refraction. Purely sequential algorithm, slow execution.
MIT License
Copyright (c) 2017 Cyrille Rossant
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is