163164165166167168169
for (Preference pref : prefs) { long itemId = pref.getItemID(); int itemIdx = itemIndex(itemId); confidenceMatrix.setQuick(itemIdx, itemIdx, 1); } return new DiagonalMatrix(confidenceMatrix); }
180181182183184185186187
private Matrix ones(int size) { double[] vector = new double[size]; for (int i = 0; i < size; i++) { vector[i] = 1; } Matrix ones = new DiagonalMatrix(vector); return ones; }
88899091929394
return fileName.matches("V-.*"); } }))); // The values in A are pretty big so this is a pretty tight relative tolerance assertEquals(0, A.minus(u.times(new DiagonalMatrix(s.getSingularValues())).times(v.transpose())).aggregate(Functions.PLUS, Functions.ABS), 1.0e-7); }