code: private double computeIDCG(final U user, final Map<I, Double> userTestItems) {
          double idcg = 0.0;
          // sort the items according to their relevance level
          List<Double> sortedList = rankScores(userTestItems);
          int rank = 1;
          for (double itemRel : sortedList) {
              idcg += computeDCG(itemRel, rank);
              // compute at a particular cutoff
              for (int at : getCutoffs()) {
                  if (rank == at) {
                      Map<U, Double> m = userIdcgAtCutoff.get(at);
                      if (m == null) {
                          m = new HashMap<U, Double>();
                          userIdcgAtCutoff.put(at, m);
                      }
                      m.put(user, idcg);
                  }
              }
              rank++;
          }
          // assign the ndcg of the whole list to those cutoffs larger than the list's size
          for (int at : getCutoffs()) {
              if (rank <= at) {
                  Map<U, Double> m = userIdcgAtCutoff.get(at);
                  if (m == null) {
                      m = new HashMap<U, Double>();
                      userIdcgAtCutoff.put(at, m);
                  }
                  m.put(user, idcg);
              }
          }
          return idcg;
      }
docs: Computes the ideal <a
  href="http://recsyswiki.com/wiki/Discounted_Cumulative_Gain"
  target="_blank">discounted cumulative gain</a> (IDCG) given the test set
  (groundtruth items) for a user.
  
  @param user the user
  @param userTestItems the groundtruth items of a user.
  @return the IDCG