Parametrize a Covariance Matrix using Archakov & Hansen (2021)

When estimating a covariance matrix we need the matrix to be symmetric and positive semi-definite (psd). The way to do this is to parametrize the covariance matrix such that for any real valued parameter vector the associated covariance matrix is psd. Archakov & Hansen (2021) - A New Parametrization of Correlation Matrices introduce a nice way to parametrize the covariance matrix.

Here is a matlab code CoVarMatrix.m that shows how to use/understand/implement Archakov & Hansen (2021). It shows the steps involved, and includes a lightly edited version of the code implementing their method. The code is commented explaining how the AH2021 method works, and how the code goes about implementing it at each step.
https://github.com/robertdkirkby/ParametrizeCoVarianceMatrix/

Note, the version of GFT_inverse_mapping() used in this example is included as part of VFI Toolkit (the copy in this repo is just for convenience so the repo is self-contained/standalone).