function [M Mi]=buildDiagonalCovarianceMatrix(v) M=diag(v.*v); % elements on the diagonal: v(i)*v(i) Mi=inv(M); % inverse covariance matrix endfunction