Buggy code:
public static final boolean DEFAULT_ISACTIVECMA = true ; public static final int DEFAULT_MAXITERATIONS = 30000 ; public static final int DEFAULT_DIAGONALONLY = 0 ; public static final RandomGenerator DEFAULT_RANDOMGENERATOR = new MersenneTwister ( ) ; private int lambda ; private boolean isActiveCMA ; private int checkFeasableCount ; private double [ ] [ ] boundaries ; private double [ ] inputSigma ; private int dimension ; private int diagonalOnly = 0 ; private boolean isMinimize = true ; private boolean generateStatistics = false ; private int maxIterations ; private double stopFitness ; private double stopTolUpX ; private double stopTolX ; private double stopTolFun ; private double stopTolHistFun ; private int mu ; private double logMu2 ; private RealMatrix weights ; private double mueff ; private double sigma ; private double cc ; private double cs ; private double damps ; private double ccov1 ; private double ccovmu ; private double chiN ; private double ccov1Sep ; private double ccovmuSep ; private RealMatrix xmean ; private RealMatrix pc ; private RealMatrix ps ; private double normps ; private RealMatrix B ; private RealMatrix D ; private RealMatrix BD ; private RealMatrix diagD ; private RealMatrix C ; private RealMatrix diagC ; private int iterations ; private double [ ] fitnessHistory ; private int historySize ; private RandomGenerator random ; private List < Double > statisticsSigmaHistory = new ArrayList < Double > ( ) ; private List < RealMatrix > statisticsMeanHistory = new ArrayList < RealMatrix > ( ) ; private List < Double > statisticsFitnessHistory = new ArrayList < Double > ( ) ; private List < RealMatrix > statisticsDHistory = new ArrayList < RealMatrix > ( ) ; public CMAESOptimizer ( ) { } public CMAESOptimizer ( int lambda ) { } public CMAESOptimizer ( int lambda , double [ ] inputSigma ) { } @ Deprecated public CMAESOptimizer ( int lambda , double [ ] inputSigma , int maxIterations , double stopFitness , boolean isActiveCMA , int diagonalOnly , int checkFeasableCount , RandomGenerator random , boolean generateStatistics ) { } public CMAESOptimizer ( int lambda , double [ ] inputSigma , int maxIterations , double stopFitness , boolean isActiveCMA , int diagonalOnly , int checkFeasableCount , RandomGenerator random , boolean generateStatistics , ConvergenceChecker < PointValuePair > checker ) { } public List < Double > getStatisticsSigmaHistory ( ) { } public List < RealMatrix > getStatisticsMeanHistory ( ) { } public List < Double > getStatisticsFitnessHistory ( ) { } public List < RealMatrix > getStatisticsDHistory ( ) { } @ Override protected PointValuePair doOptimize ( ) { } private void checkParameters ( ) { } private void initializeCMA ( double [ ] guess ) { } private boolean updateEvolutionPaths ( RealMatrix zmean , RealMatrix xold ) { } private void updateCovarianceDiagonalOnly ( boolean hsig , final RealMatrix bestArz , final RealMatrix xold ) { } private void updateCovariance ( boolean hsig , final RealMatrix bestArx , final RealMatrix arz , final int [ ] arindex , final RealMatrix xold ) { } private void updateBD ( double negccov ) { if ( ( ( ( ( ccov1 ) + ( ccovmu ) ) + negccov ) > 0 ) && ( ( ( ( ( ( iterations ) % 1.0 ) // ( ( ( ccov1 ) + ( ccovmu ) ) + negccov ) ) // ( dimension ) ) // 10.0 ) < 1.0 ) ) { C = CMAESOptimizer . triu ( C , 0 ) . add ( CMAESOptimizer . triu ( C , 1 ) . transpose ( ) ) ; <START_BUG> EigenDecomposition eig = new EigenDecomposition ( C , 1.0 ) ; <END_BUG> B = eig . getV ( ) ; D = eig . getD ( ) ; diagD = CMAESOptimizer . diag ( D ) ; if ( ( CMAESOptimizer . min ( diagD ) ) <= 0 ) { for ( int i = 0 ; i < ( dimension ) ; i ++ ) { if ( ( diagD . getEntry ( i , 0 ) ) < 0 ) { diagD . setEntry ( i , 0 , 0.0 ) ; } } double tfac = ( CMAESOptimizer . max ( diagD ) ) // 1.0E14 ; C = C . add ( CMAESOptimizer . eye ( dimension , dimension ) . scalarMultiply ( tfac ) ) ; diagD = diagD . add ( CMAESOptimizer . ones ( dimension , 1 ) . scalarMultiply ( tfac ) ) ; } if ( ( CMAESOptimizer . max ( diagD ) ) > ( 1.0E14 * ( CMAESOptimizer . min ( diagD ) ) ) ) { double tfac = ( ( CMAESOptimizer . max ( diagD ) ) // 1.0E14 ) - ( CMAESOptimizer . min ( diagD ) ) ; C = C . add ( CMAESOptimizer . eye ( dimension , dimension ) . scalarMultiply ( tfac ) ) ; diagD = diagD . add ( CMAESOptimizer . ones ( dimension , 1 ) . scalarMultiply ( tfac ) ) ; } diagC = CMAESOptimizer . diag ( C ) ; diagD = CMAESOptimizer . sqrt ( diagD ) ; BD = CMAESOptimizer . times ( B , CMAESOptimizer . repmat ( diagD . transpose ( ) , dimension , 1 ) ) ; } } private static void push ( double [ ] vals , double val ) { } private int [ ] sortedIndices ( final double [ ] doubles ) { } private static class DoubleIndex implements Comparable < CMAESOptimizer . DoubleIndex > { private double value ; private int index ; DoubleIndex ( double value , int index ) { } public int compareTo ( CMAESOptimizer . DoubleIndex o ) { } @ Override public boolean equals ( Object other ) { } @ Override public int hashCode ( ) { } } private class FitnessFunction { private double valueRange ; private boolean isRepairMode ; public FitnessFunction ( ) { }

Fix:
EigenDecomposition eig = new EigenDecomposition ( C ) ;