Diagonalization procedures for Julia (PCA, Whitening, MCA, gMCA, CCA, gCCA, CSP, CSTP, AJD, mAJD)
Author Marco-Congedo
29 Stars
Updated Last
4 Months Ago
Started In
January 2020



Diagonalizations.jl is a Julia signal processing package implementing several closed form and iterative diagonalization procedures for both real and complex data input:

Acronym Full Name Datasets ( m ) Observations ( k )
PCA Principal Component Analysis 1 1
Whitening Whitening (Sphering) 1 1
MCA Maximum Covariance Analysis 2 1
CCA Canonical Correlation Analysis 2 1
gMCA generalized MCA >1 1
gCCA generalized CCA >1 1
CSP Common Spatial Pattern 1 2
CSTP Common Spatio-Temporal Pattern 1 >1
AJD Approximate Joint Diagonalization 1 >1
mAJD multiple AJD >1 >1

For example the MCA diagonalizes a cross-covariance matrix, like in this figure:

As compared to MultivariateStats.jl this package supports :

  • the dims keyword like in the StatsBase.jl package
  • shrinkage covariance matrix estimations throught package CovarianceEstimation
  • average covariance estimations using metrics for the manifold of positive definite matrices using the PosDefManifold package
  • facilities to set the subspace dimension upon construction
  • diagonalization procedures for the case m≥2 and k≥2.

This package implements state-of-the-art approximate joint diagonalization algorithms. For some benchmarking see here.


To install the package execute the following command in Julia's REPL:

]add CovarianceEstimation PosDefManifold Diagonalizations


using Diagonalizations, PosDefManifold, Test

n, t=10, 100

# generate an nxt data matrix
X=genDataMatrix(n, t)

# principal component analysis

# the following is an equivalent constructor taking the covariance matrix as input

@test pX==pC # the output of the two constructors above is equivalent

@test C≈pC.F*pC.D*pC.F'  

# get only the first p eigenvectors, where p is the smallest integer
# explaining at least 75% of the variance
pX=pca(X; eVar=0.75)

Y=genDataMatrix(n, t)

# maximum covariance analysis
mXY=mca(X, Y)

# canonical correlation analysis
cXY=cca(X, Y)

# approximate joint diagonalization
Xset=randP(5, 20)
aXset=ajd(Xset; algorithm=:JADE)
aXset=ajd(Xset; algorithm=:LogLike)

# etc., etc.

About the Authors

Marco Congedo, is a research scientist of CNRS (Centre National de la Recherche Scientifique), working at UGA (University of Grenoble Alpes). contact: marco dot congedo at gmail dot com


Used By Packages

No packages found.