void comp() {
        double[][] tempPoints = new double[totalNumOfPoints][numOfParams];
        double[] tempObjFuncValues = new double[totalNumOfPoints];

        // copy selected elements in pointsX and objFuncValueOfX to tempPoints and tempObjFuncValues
        for (int igs = 0; igs < currentNumOfComplexes; igs++) {
            for (int ipg = 0; ipg < numOfPointsInComplex; ipg++) {
                int k1 = ipg * lastNumOfComplexes + igs;
                int k2 = ipg * currentNumOfComplexes + igs;
                for (int i = 0; i < numOfParams; i++) {
                    tempPoints[k2][i] = pointsX[k1][i];
                }
                tempObjFuncValues[k2] = objFuncValueOfX[k1];
            }
        }
        // reinitialize pointsX and objFuncValueOfX with a correct size
        pointsX = new double[totalNumOfPoints][numOfParams];
        objFuncValueOfX = new double[totalNumOfPoints];
        // copy elements of tempPointx and tempObjFuncValues back to pointsX and objFuncValueOfX
        for (int j = 0; j < totalNumOfPoints; j++) {
            for (int i = 0; i < numOfParams; i++) {
                pointsX[j][i] = tempPoints[j][i];
            }
            objFuncValueOfX[j] = tempObjFuncValues[j];
        }
    }