@Override
    public void computePerformanceMeasures() throws InternalErrorException {
        totalTimer.start();
        BigRational[] X = new BigRational[qnm.R];
        BigRational[][] Q = new BigRational[qnm.M][qnm.R];

        if (lastG[0].isUndefined()) {
            throw new InternalErrorException(("Singular system. Cannot compute performance indices."));
        }
        for (int i = 0; i < qnm.M; i++) {
            for (int r = 0; r < qnm.R - 1; r++) {
                if (!lastG[sz * (r + 1) + i + 1].isUndefined()) {
                    Q[i][r] = qnm.getDemandAsBigRational(i, r).multiply(lastG[sz * (r + 1) + i + 1]).divide(lastG[0]);
                } else {
                    throw new InternalErrorException(("Singular system. Cannot compute performance indices."));
                }
            }
            if (!prevG[i + 1].isUndefined()) {
                Q[i][qnm.R - 1] = qnm.getDemandAsBigRational(i, qnm.R - 1).multiply(prevG[i + 1]).divide(lastG[0]);
            } else {
                throw new InternalErrorException(("Singular system. Cannot compute performance indices."));
            }
        }
        for (int r = 0; r < qnm.R - 1; r++) {
            if (!lastG[sz * (r + 1)].isUndefined()) {
                X[r] = lastG[sz * (r + 1)].divide(lastG[0]);
            } else {
                throw new InternalErrorException(("Singular system. Cannot compute performance indices."));
            }
        }
        if (!prevG[0].isUndefined()) {
            X[qnm.R - 1] = prevG[0].divide(lastG[0]);
        } else {
            throw new InternalErrorException(("Singular system. Cannot compute performance indices."));
        }
        totalTimer.pause();
        qnm.setPerformanceMeasures(Q, X);
    }