public MarketEquilibrium clean ( ) { final PrimitiveMatrix tmpAssetVolatilities = FinanceUtils . toVolatilities ( myCovariances , true ) ; final PrimitiveMatrix tmpCleanedCorrelations = FinanceUtils . toCorrelations ( myCovariances , true ) ; final PrimitiveMatrix tmpCovariances = FinanceUtils . toCovariances ( tmpAssetVolatilities , tmpCleanedCorrelations ) ; return new MarketEquilibrium ( myAssetKeys , tmpCovariances , myRiskAversion ) ; }
Equivalent to copying but additionally the covariance matrix will be cleaned of negative and very small eigenvalues to make it positive definite .