A New Parametrization of Correlation Matrices
Implementation of the new transformation for correlation matrices introduced in the paper "A New Parametrization of Correlation Matrices" by Archakov and Hansen (2018). The program consists of two functions. The first function, direct_mapping_mat, performs a direct tranform of a non-singular correlation matrix into an unconstrained real vector. The second function, inverse_mapping_vec, provides an inverse mapping that transforms a real vector of proper dimensionality to a unique correlation matrix that corresponds to a given vector.
Function direct_mapping_mat takes a correlation matrix (square, positive definite and having ones on the main diagonal) as an argument. It returns a real vector of dimension n(n-1)/2 (where n is a size of input matrix).
Function inverse_mapping_vec takes two arguments. The first argument is a real vector of size n(n-1)/2 (for some integer n larger than 1). The second argument is a tolerance value which has to be a positive number not exceeding 1e-4. In case the second argument is not provided, the tolerance value is set to its default, 1e-8. The tolerance value controls the precision of convergence of the inverse mapping algorithm. The smaller value implies a more accurate convergence to the appropriate correlation matrix. The function returns the corresponding correlation matrix and the number of iterations required by the algorithm to achieve a specified tolerance of convergence.
The program is provided for Python and Matlab. The Python implementation resides in file new_correlation_transform.py which contains both direct and inverse mapping functions. For direct_mapping_mat, the argument has to be a 2D numpy array and the output is produced in a format of 1D numpy array. For inverse_mapping_vec, the argument vector has to be either an 1D numpy array or a list and the output matrix is produced in a format of 2D numpy array.