Skip to content

Instantly share code, notes, and snippets.

View severinson's full-sized avatar

Albin Severinson severinson

View GitHub Profile
@severinson
severinson / PCAGD.jl
Created September 6, 2020 15:08
PCA via gradient sketching
using Random
using LinearAlgebra
using LowRankApprox
"""Orthogonalize and normalize the columns of A in-place."""
function orthogonal!(A)
m, n = size(A)
@inbounds for i in 1:n
@inbounds for j in 1:i-1
view(A, :, i) .-= dot(view(A, :, j), view(A, :, i)) .* view(A, :, j)