Skip to content

Instantly share code, notes, and snippets.

@smc77
Created April 22, 2012 17:05
Show Gist options
  • Save smc77/2465348 to your computer and use it in GitHub Desktop.
Save smc77/2465348 to your computer and use it in GitHub Desktop.
Normal Equation (with Julia)
A = [1 1; 1 2; 1 3; 1 4]; b = [2 1 1 1]';
[m, n] = size(A);
C = A' * A; c = A' *b; bb = b'*b;
Cbar = [C c; c' bb];
Gbar = chol(Cbar)';
G = Gbar(1:2, 1:2); z = Gbar(3, 1:2)'; rho = Gbar(3, 3);
x = G'\z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment