Matlab Complexity Toolbox

This toolbox contains a set of functions used to calculate complexity from the covariance (correlation) matrix of a system. Please read the comments carefully - the functions will only give valid results if certain statistical assumptions are valid.  
Included is also a function for deriving covariance matrices from anatomical connection matrices, given linear dynamics and uncorrelated noise. 

Here are the individual functions, together with a brief description of what they do.
Papers that define these measures in detail and describe their application to various neurobiological problems can be found here.

This software is free.  Use at your own risk.  Report bugs etc. to


This script runs through all of the different ways of calculating description complexity and neural complexity.  Which function should be used depends on the application.  'calcC_det' and 'calcC_alt' are often faster than 'calcC_eig' or 'calcC_svd', but those two methods might be the only ones that are numerically stable once n gets large.  I'd suggest running 'calcC_test' with a few sample matrices and comparing the output and cpu times.  In some cases, "neural complexity" (that is, the full spectrum of hierarchical integrations/entropies) may be desired. 

Function for calculating the covariance matrix (linear systems) from a connection matrix CIJ.


Function for calculating the neural complexity from the hierarchical integration of system X, over all levels 1,...,n.  Due to combinatorics, random sampling of subpartitions has to be carried out for most of the levels.  Sample size is one of the parameters of the function.  The function delivers graphical output of the result using the associated function plotC_Ndet.m.  Note that the description complexity (see  below) is indicated in the plot in order to show the relationship between these two (mathematically not identical) measures.


Function for calculating the description complexity, using the determinant of the covariance matrices to obtain entropies.


Function for calculating the description complexity, using the eigenvalues of the correlation matrix.


Function for calculating the description complexity, using the singular value distribution.


Function for calculating the description complexity, using a different numerical algorithm, which I found in Tom Minka's lightspeed toolbox:

Use these connectivity sets to run with calcC_test.m

Connection matrix of the macaque cortex (as used in the article listed above) with N=71, K=755.  The matrix is based on Malcolm Young's 1993 paper.

A random connection matrix, with the same number of units and connections as macaque71.mat (N=71, K=755).  This matrix was generated by running 'makerandCIJ.m' (see connectivity toolbox).

Connection matrix of the macaque visual cortex, after Felleman and Van Essen (1991), with N=30, K=311.  Compared to the original matrix, some areas have been eliminated or consolidated (see Sporns et al., 2000 or Hilgetag et al., 2000 for discussion).