# Correlation.m

Correlation order selection function - keeps only the specified orders of spin correlation in the state vector. Syntax:

    rho=correlation(spin_system,rho,correlation_orders,spins)


Arguments:

    rho                -  a state vector or a horizontal stack thereof
correlation_orders -  a row vector of correlation orders to keep
spins              -  which spins to count (e.g. '1H', '13C', 'all')


If rho is left empty then the binary state mask is returned, with ones for the states that should be kept and zeros for the states that should be wiped.

This is useful as a replacement for gradients and phase cycles because coherence order filtering can be accomplished analytically, by just picking out the required coherence orders and zeroing everything else. Because projection quantum number information is required for this function to work, it is restricted to sphten-liouv formalism.