Skip to content

Instantly share code, notes, and snippets.

View ahbarnett's full-sized avatar

Alex Barnett ahbarnett

View GitHub Profile
@ahbarnett
ahbarnett / svd_deriv.m
Created March 5, 2026 21:03
Semianalytic derivative of the complex SVD, illustrated in MATLAB
% (Semi)analytic deriv of complex SVD wrt parameter-dep matrix.
% Barnett 5/2/25
clear
verb=0;
m=6; n=4; % size
rng(0); % seed
for k=0:3, Ak{k+1} = randn(m,n)+1i*randn(m,n); end % coeff mats
% generic random C-valued matrix poly, deg-3
Afun = @(z) Ak{1} + z*Ak{2} + z^2*Ak{3} + z^3*Ak{4};
@ahbarnett
ahbarnett / fwam25demos.jl
Created October 17, 2025 21:06
FWAM25 1D function interpolation Julia demos script
# FWAM25 demos on 1D func interpolation. all one big script.
# Used to generate figs for slides. Paste the bits you need.
# Barnett 10/13/25
using LinearAlgebra, CairoMakie, Chairmarks, Printf
using SpecialFunctions
using PolynomialRoots
fcostly(x) = sum((1.0/k)^x for k=1:1000000) # expensive func
fcostly(2.0)
# [details for experts...