Skip to content

joshday/SweepOperator.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SweepOperator

Build Test
CI codecov.io

The symmetric sweep operator (a.k.a. principal pivot transform) is a powerful tool in computational statistics with uses in stepwise regression, conditional multivariate normal distributions, MANOVA, and more. This package exports a single function:

sweep!

sweep!(A, k ; inv=false)
sweep!(A, ks; inv=false)

Perform the sweep operation (or inverse sweep if inv=true) on symmetric matrix A on element k (or each element in ks). Only the upper triangle is read/swept.

Example:

x = randn(100, 10)
xtx = x'x
sweep!(xtx, 1)
sweep!(xtx, 1, true)

Details on Symmetric Sweeping:

Thank you to great notes provided by @Hua-Zhou