protected DenseDesignMatrix createDesignMatrix(DenseDataset dd, List<int[]> groupList) {
		int[] attrs = dd.attrs;
		Map<Integer, Integer> attrSet = new HashMap<>();
		for (int j = 0; j < attrs.length; j++) {
			attrSet.put(attrs[j], j);
		}
		List<int[]> gList = new ArrayList<>();
		for (int[] group : groupList) {
			List<Integer> list = new ArrayList<>();
			for (int idx : group) {
				if (attrSet.containsKey(idx)) {
					list.add(attrSet.get(idx));
				}
			}
			if (list.size() > 0) {
				int[] a = new int[list.size()];
				for (int i = 0; i < a.length; i++) {
					a[i] = list.get(i);
				}
				gList.add(a);
			}
		}
		int[][] groups = new int[gList.size()][];
		double[][][] x = new double[gList.size()][][];
		for (int g = 0; g < groups.length; g++) {
			int[] group = gList.get(g);
			groups[g] = group;
			double[][] v = new double[group.length][];
			for (int j = 0; j < group.length; j++) {
				int idx = group[j];
				v[j] = dd.x[idx];
			}
			x[g] = v;
		}
		return new DenseDesignMatrix(groups, x);
	}