Folds non-zero elements of the specified row in this matrix with the given {@code accumulator}.

@param i the row index.
@param accumulator the {@link VectorAccumulator}.

@return the accumulated value.
488548
public double foldNonZeroInRow(int i, VectorAccumulator accumulator) {
        eachNonZeroInRow(i, Vectors.asAccumulatorProcedure(accumulator));
        return accumulator.accumulate();
    }
150519
public void accumulate(Object workingMemoryContext,
                           Object context,
                           Tuple tuple,
                           InternalFactHandle handle,
                           Declaration[] declarations,
                           Declaration[] innerDeclarations,
                           WorkingMemory workingMemory) throws Exception {
        
        VariableResolverFactory factory = unit.getFactory( null, null, null, handle, tuple, null, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver()  );
        
        final Object value = MVEL.executeExpression( this.expression,
                                                     handle.getObject(),
                                                     factory );
        if ( this.function.supportsReverse() ) {
            ((MVELAccumulatorFunctionContext) context).reverseSupport.put( handle.getId(), value );
        }
        this.function.accumulate( ((MVELAccumulatorFunctionContext) context).context,
                                  value );
    }
802317
public AccumulatorDefinition toAccumulatorDefinition(String producerId){
		AccumulatorDefinition ret = new AccumulatorDefinition();
		ret.setProducerName(producerId);
		ret.setName(replaceName(producerId));
		ret.setStatName(getStatName());
		ret.setValueName(getValueName());
		ret.setIntervalName(getIntervalName());
		ret.setTimeUnit(getTimeUnit());
		return ret;

	}
177654
public static double sum(final double[] v1) {
    double acc = 0.;
    for(int row = 0; row < v1.length; row++) {
      acc += v1[row];
    }
    return acc;
  }
371144
public void updateRow(int i, VectorFunction function) {
        VectorIterator it = iteratorOfRow(i);

        while (it.hasNext()) {
            double x = it.next();
            int j = it.index();
            it.set(function.evaluate(j, x));
        }
    }
1221629
public Datum<SparseArray> remove(int i) {
        Datum<SparseArray> datum = data.remove(i);

        n -= datum.x.size();
        for (SparseArray.Entry item : datum.x) {
            colSize[item.i]--;
        }
        
        return datum;
    }
393851
function (projection = '') {

      //prepare projections
      let fields = _.compact(projection.split(','));
      fields = _.map(fields, _.trim);
      fields = _.uniq(fields);
      const accumulator = {};

      _.forEach(fields, function (field) {

        //if exclude e.g -name
        if (field[0] === '-') {
          accumulator[field.substring(1)] = 0;
        }

        //if include i.e name
        else {
          accumulator[field] = 1;
        }

      });

      return accumulator;
    }
971988
public static MatrixAccumulator mkMaxAccumulator() {
        return new MatrixAccumulator() {
            private double result = Double.NEGATIVE_INFINITY;

            @Override
            public void update(int i, int j, double value) {
                result = Math.max(result, value);
            }

            @Override
            public double accumulate() {
                double value = result;
                result = Double.NEGATIVE_INFINITY;
                return value;
            }
        };
    }
116343
@Override
  public <R> StreamBuilderImpl<R,U> 
  reduce(R identity, 
         BiFunctionSync<R, ? super T, R> accumulator,
         BinaryOperatorSync<R> combiner)
  {
    return new ReduceAccumSync<>(this, identity, accumulator, combiner);
  }
1293984
@Override
	public OUT get() {
		ACC accumulator = getInternal();
		return accumulator != null ? aggregateTransformation.aggFunction.getResult(accumulator) : null;
	}
478737
public void removeElementAt(int i)
  {

    if (null == m_map)
      return;
      
    if (i >= m_firstFree)
      throw new ArrayIndexOutOfBoundsException(i + " >= " + m_firstFree);
    else if (i < 0)
      throw new ArrayIndexOutOfBoundsException(i);

    if (i < m_firstFree - 1)
      System.arraycopy(m_map, i + 1, m_map, i, m_firstFree - i - 1);

    m_firstFree--;
    m_map[m_firstFree] = null;
  }
201171
private void createClassLevelAccumulators(final OnDemandStatsProducer<S> producer, final Class producerClass) {

		//several @AccumulateWithSubClasses in accumulators holder
		final AccumulatesWithSubClasses accWSCAnnotationHolder = AnnotationUtils.findAnnotation(producerClass, AccumulatesWithSubClasses.class);
		if (accWSCAnnotationHolder != null) {
			createAccumulators(producer, producerClass, accWSCAnnotationHolder.value());
		}

		//If there is no @AccumulatesWithSubClasses annotation but @Accumulate is present
		final AccumulateWithSubClasses accumulateWSC = AnnotationUtils.findAnnotation(producerClass, AccumulateWithSubClasses.class);
		createAccumulators(producer, producerClass, accumulateWSC);

		//several @Accumulate in accumulators holder
		final Accumulates accAnnotationHolder = AnnotationUtils.findAnnotation(producerClass, Accumulates.class);
		if (accAnnotationHolder != null) {
			createAccumulators(producer, null, accAnnotationHolder.value());
		}

		//If there is no @Accumulates annotation but @Accumulate is present
		final Accumulate annotation = AnnotationUtils.findAnnotation(producerClass, Accumulate.class);
		createAccumulators(producer, null, annotation);
	}
826728
private void createAccumulator(String producerId, Accumulate annotation, String accName, String statsName) {
        if (annotation != null && producerId != null && !producerId.isEmpty() &&
                accName!=null && !accName.isEmpty() && statsName != null && !statsName.isEmpty()){

            AccumulatorDefinition definition = new AccumulatorDefinition();
            if (annotation.name().length() > 0) {
                definition.setName(annotation.name());
            }else{
                definition.setName(accName);
            }
            definition.setIntervalName(annotation.intervalName());
            definition.setProducerName(producerId);
            definition.setStatName(statsName);
            definition.setValueName(annotation.valueName());
            definition.setTimeUnit(annotation.timeUnit());
            AccumulatorRepository.getInstance().createAccumulator(definition);
        }
    }
488599
public static void compareAccumulatorTypes(Object name,
			@SuppressWarnings("rawtypes") Class<? extends Accumulator> first,
			@SuppressWarnings("rawtypes") Class<? extends Accumulator> second)
			throws UnsupportedOperationException {
		if (first != second) {
			throw new UnsupportedOperationException("The accumulator object '" + name
					+ "' was created with two different types: " + first + " and " + second);
		}
	}
742979
function reduceit(v, i) {
    if (i >= this.rmin) {
      return undefined;
    }
    this.accumulater[i] += (v / this.scale[i]);
    return this.accumulater[i];
  }
794411
public static int xDigitToInt(int c, int accumulator)
    {
        check: {
            // Use 0..9 < A..Z < a..z
            if (c <= '9') {
                c -= '0';
                if (0 <= c) { break check; }
            } else if (c <= 'F') {
                if ('A' <= c) {
                    c -= ('A' - 10);
                    break check;
                }
            } else if (c <= 'f') {
                if ('a' <= c) {
                    c -= ('a' - 10);
                    break check;
                }
            }
            return -1;
        }
        return (accumulator << 4) | c;
    }
1314991
function _makeReducer (step) {
    return function (arrayLike, accumulator, initialValue) {
        var len = _toArrayLength(arrayLike.length);
        var idx = step === 1 ? 0 : len - 1;
        var nCalls;
        var result;

        if (arguments.length === 3) {
            nCalls = len;
            result = initialValue;
        } else {
            if (len === 0) {
                throw new TypeError("Reduce of empty array-like with no initial value");
            }

            result = arrayLike[idx];
            idx += step;
            nCalls = len - 1;
        }

        for (; nCalls--; idx += step) {
            result = accumulator(result, arrayLike[idx], idx, arrayLike);
        }

        return result;
    };
}