You are here

linear algebra

A Dirt Simple Algorithm for a Reflexive Generalized Inverse

Tags: 

let A be a m by n matrix considered as a list of columns
construct B, an n by m matrix (considered as a list of rows), by elimination
such that BAB = B, ABA = A and AB an orthogonal projection onto the image of A

in exact artihmetic and pythonesque psuedo-code:


B = array(A)
for k,a in enumerate(A):
    v = B[k] # pivot row
    va = inner(v,a)
    if va: # note that v nonzero if and only if va positive
        v *= 1/va # scale on <a>
        for j,b in enumerate(B):
            if j == k: continue
            b = b - inner(b,a)*v # elimination on <a>
Subscribe to RSS - linear algebra