PLUS_MULT.setMultiplicator(alpha); x.assign(updateDirection, PLUS_MULT); PLUS_MULT.setMultiplicator(-alpha); residual.assign(aTimesUpdate, PLUS_MULT);
/** * Constructs a function that returns <tt>a + b*constant</tt>. <tt>a</tt> and <tt>b</tt> are variables, * <tt>constant</tt> is fixed. */ public static DoubleDoubleFunction plusMult(double constant) { return new PlusMult(constant); }
public void plusRow(int index, Vector row) { /* * often accumulation goes in row-increasing order, so check for this to * avoid binary search (another log Height multiplier). */ int pos = numRows == 0 || rowIndices[numRows - 1] < index ? -numRows - 1 : Arrays .binarySearch(rowIndices, 0, numRows, index); if (pos >= 0) { rows[pos].assign(row, PlusMult.plusMult(1)); } else { insertIntoPos(-pos - 1, index, row); } }
double multiplicator = ((PlusMult) function).getMultiplicator(); if (multiplicator == 0) { // x[i] = x[i] + 0*y[i] return this;
public void plusRow(int index, Vector row) { /* * often accumulation goes in row-increasing order, so check for this to * avoid binary search (another log Height multiplier). */ int pos = numRows == 0 || rowIndices[numRows - 1] < index ? -numRows - 1 : Arrays .binarySearch(rowIndices, 0, numRows, index); if (pos >= 0) { rows[pos].assign(row, PlusMult.plusMult(1)); } else { insertIntoPos(-pos - 1, index, row); } }
double multiplicator = ((PlusMult) function).getMultiplicator(); if (multiplicator == 0) { // x[i] = x[i] + 0*y[i] return this;
@Override public boolean apply(int key, double value) { int i = key / columns; int j = key % columns; fun.setMultiplicator(value * alpha); if (transposeA) { Crows[j].assign(Brows[i], fun); } else { Crows[i].assign(Brows[j], fun); } return true; } }
public void plusRow(int index, Vector row) { /* * often accumulation goes in row-increasing order, so check for this to * avoid binary search (another log Height multiplier). */ int pos = numRows == 0 || rowIndices[numRows - 1] < index ? -numRows - 1 : Arrays .binarySearch(rowIndices, 0, numRows, index); if (pos >= 0) { rows[pos].assign(row, PlusMult.plusMult(1)); } else { insertIntoPos(-pos - 1, index, row); } }
/** <tt>a - b*constant</tt>. */ public static PlusMult minusMult(double constant) { return new PlusMult(-constant); }
final double alpha = ((PlusMult) function).getMultiplicator(); if (alpha == 0) { return this;
@Override protected void map(IntWritable key, VectorWritable value, Context context) throws IOException, InterruptedException { Vector bCol = value.get(); /* * MAHOUT-817: PCA correction for B': b_{col=i} -= s_q * xi_{i} */ if (xi != null) { /* * code defensively against shortened xi which may be externally * supplied */ int btIndex = key.get(); double xii = xi.size() > btIndex ? xi.getQuick(btIndex) : 0.0; plusMult.setMultiplicator(-xii); bCol.assign(sq, plusMult); } for (int i = 0; i < k; i++) { vRow.setQuick(i, bCol.dot(uHat.viewColumn(i)) / sValues.getQuick(i)); } context.write(key, vRowWritable); }
rows[i].assign(bOther.rows[j], PlusMult.plusMult(1)); } else {
/** <tt>a + b*constant</tt>. */ public static PlusMult plusMult(double constant) { return new PlusMult(constant); }
double multiplicator = ((PlusMult) function).getMultiplicator(); if (multiplicator == 0.0) { // x[i] = x[i] + 0*y[i]
@Override protected void map(IntWritable key, VectorWritable value, Context context) throws IOException, InterruptedException { Vector bCol = value.get(); /* * MAHOUT-817: PCA correction for B': b_{col=i} -= s_q * xi_{i} */ if (xi != null) { /* * code defensively against shortened xi which may be externally * supplied */ int btIndex = key.get(); double xii = xi.size() > btIndex ? xi.getQuick(btIndex) : 0.0; plusMult.setMultiplicator(-xii); bCol.assign(sq, plusMult); } for (int i = 0; i < k; i++) { vRow.setQuick(i, bCol.dot(uHat.viewColumn(i)) / sValues.getQuick(i)); } context.write(key, vRowWritable); }
rows[i].assign(bOther.rows[j], PlusMult.plusMult(1)); } else {
protected static void orthoganalizeAgainstAllButLast(Vector nextVector, LanczosState state) { for (int i = 0; i < state.getIterationNumber(); i++) { Vector basisVector = state.getBasisVector(i); double alpha; if (basisVector == null || (alpha = nextVector.dot(basisVector)) == 0.0) { continue; } nextVector.assign(basisVector, new PlusMult(-alpha)); } }
@Override protected void map(IntWritable key, VectorWritable value, Context context) throws IOException, InterruptedException { Vector bCol = value.get(); /* * MAHOUT-817: PCA correction for B': b_{col=i} -= s_q * xi_{i} */ if (xi != null) { /* * code defensively against shortened xi which may be externally * supplied */ int btIndex = key.get(); double xii = xi.size() > btIndex ? xi.getQuick(btIndex) : 0.0; plusMult.setMultiplicator(-xii); bCol.assign(sq, plusMult); } for (int i = 0; i < k; i++) { vRow.setQuick(i, bCol.dot(uHat.viewColumn(i)) / sValues.getQuick(i)); } context.write(key, vRowWritable); }
rows[i].assign(bOther.rows[j], PlusMult.plusMult(1)); } else {
currentPseudoEigen.assign(previousEigen, new PlusMult(-state.getHelperVector().get(i))); state.getHelperVector().set(i, 0);