Creates a sum matrix accumulator that calculates the sum of all elements in the matrix.

@param neutral the neutral value

@return a sum accumulator
973192
public static MatrixAccumulator asSumAccumulator(final double neutral) {
        return new MatrixAccumulator() {
            private BigDecimal result = BigDecimal.valueOf(neutral);

            @Override
            public void update(int i, int j, double value) {
                result = result.add(BigDecimal.valueOf(value));
            }

            @Override
            public double accumulate() {
                double value = result.setScale(Matrices.ROUND_FACTOR, RoundingMode.CEILING).doubleValue();
                result = BigDecimal.valueOf(neutral);
                return value;
            }
        };
    }
106984
public double foldNonZeroInColumn(int j, VectorAccumulator accumulator) {
        eachNonZeroInColumn(j, Vectors.asAccumulatorProcedure(accumulator));
        return accumulator.accumulate();
    }
917555
public static double sum (double[] vector) {
        // Declare and initialize the accumulator:
        double total = 0.0;

        // Iterate over the vector:
        for (int i = 0; i < vector.length; i++) {
            total += vector[i];
        }

        // Done, return:
        return total;
    }
260982
public BBox calculateIntersection(BBox bBox) {
        if (!this.intersects(bBox))
            return null;

        double minLon = Math.max(this.minLon, bBox.minLon);
        double maxLon = Math.min(this.maxLon, bBox.maxLon);
        double minLat = Math.max(this.minLat, bBox.minLat);
        double maxLat = Math.min(this.maxLat, bBox.maxLat);

        return new BBox(minLon, maxLon, minLat, maxLat);
    }
787181
public static double sum(double[][] matrix) {
        double sum = 0; 
        for (int i=0; i<matrix.length; i++) {
            sum += sum(matrix[i]);
        }
        return sum;
    }
1009699
public static double sum(@javax.annotation.Nonnull final List<double[]> a) {
    return a.stream().parallel().mapToDouble(x -> Arrays.stream(x).sum()).sum();
  }
177654
public static double sum(final double[] v1) {
    double acc = 0.;
    for(int row = 0; row < v1.length; row++) {
      acc += v1[row];
    }
    return acc;
  }
1212005
public IntFloatSortedVector getSum(IntFloatVector other) {
        IntFloatSortedVector sum = new IntFloatSortedVector(this);
        sum.add(other);
        return sum;
    }
100241
private static <V, R extends Serializable> Accumulator<V, R> mergeSingle(Accumulator<?, ?> target,
																			 Accumulator<?, ?> toMerge) {
		@SuppressWarnings("unchecked")
		Accumulator<V, R> typedTarget = (Accumulator<V, R>) target;

		@SuppressWarnings("unchecked")
		Accumulator<V, R> typedToMerge = (Accumulator<V, R>) toMerge;

		typedTarget.merge(typedToMerge);

		return typedTarget;
	}
636940
public Matrix4f getOffsetMatrix()
    {
        Matrix4f offsetMatrix = new Matrix4f();
        offsetMatrix.set(NativeBone.getOffsetMatrix(getNative()));
        return offsetMatrix;
    }
337423
def get_neutral(array_list):
    
    res = []
    for x in array_list:
        res.append(np.zeros_like(x))
    return res
1184650
public Matrix add(double c, ExecutorService threadPool)
    {
        Matrix toReturn = getThisSideMatrix(null);
        toReturn.mutableAdd(c, threadPool);
        return toReturn;
    }
497679
public int[][] getAoMatrix(EnumFacing offset)
	{
		int[][] a = new int[3][3];

		if (offset == EnumFacing.WEST || offset == EnumFacing.EAST)
		{
			a[0][0] = a[1][0] = a[2][0] = offset.getFrontOffsetX();
			a[1][1] += Math.round(y * 2 - 1); // -1 if 0, 1 if 1;
			a[2][1] += Math.round(y * 2 - 1); // -1 if 0, 1 if 1;
			a[0][2] += Math.round(z * 2 - 1); // -1 if 0, 1 if 1;
			a[1][2] += Math.round(z * 2 - 1); // -1 if 0, 1 if 1;
		}
		else if (offset == EnumFacing.UP || offset == EnumFacing.DOWN)
		{
			a[0][1] = a[1][1] = a[2][1] = offset.getFrontOffsetY();
			a[1][0] += Math.round(x * 2 - 1); // -1 if 0, 1 if 1;
			a[2][0] += Math.round(x * 2 - 1); // -1 if 0, 1 if 1;
			a[0][2] += Math.round(z * 2 - 1); // -1 if 0, 1 if 1;
			a[1][2] += Math.round(z * 2 - 1); // -1 if 0, 1 if 1;
		}
		else if (offset == EnumFacing.NORTH || offset == EnumFacing.SOUTH)
		{
			a[0][2] = a[1][2] = a[2][2] = offset.getFrontOffsetZ();
			a[1][0] += Math.round(x * 2 - 1); // -1 if 0, 1 if 1;
			a[2][0] += Math.round(x * 2 - 1); // -1 if 0, 1 if 1;
			a[0][1] += Math.round(y * 2 - 1); // -1 if 0, 1 if 1;
			a[1][1] += Math.round(y * 2 - 1); // -1 if 0, 1 if 1;
		}

		return a;
	}
831925
public static int Median( int[] values ){
        int total = 0, n = values.length;

        // for all values
        for ( int i = 0; i < n; i++ )
        {
            // accumalate total
            total += values[i];
        }

        int halfTotal = total / 2;
        int median = 0, v = 0;

        // find median value
        for ( ; median < n; median++ )
        {
            v += values[median];
            if ( v >= halfTotal )
                break;
        }

        return median;
    }
1247050
public static MatrixAccumulator mkMinAccumulator() {
        return new MatrixAccumulator() {
            private double result = Double.POSITIVE_INFINITY;

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

            @Override
            public double accumulate() {
                double value = result;
                result = Double.POSITIVE_INFINITY;
                return value;
            }
        };
    }
756220
public static FloatMatrix normalizeRows(FloatMatrix x) {
                FloatMatrix temp = new FloatMatrix(x.columns);
		for (int r = 0; r < x.rows; r++)
			x.putRow(r, normalize(x.getRow(r, temp)));
		return x;
	}
1323001
public static AssociativeArray sum(DataTable2D classifierClassProbabilityMatrix) {
        AssociativeArray combinedClassProbabilities = new AssociativeArray(); 
        
        for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet()) {
            //Object classifier = entry.getKey();
            AssociativeArray listOfClassProbabilities = entry.getValue();
            for(Map.Entry<Object, Object> entry2 : listOfClassProbabilities.entrySet()) {
                Object theClass = entry2.getKey();
                Double probability = TypeInference.toDouble(entry2.getValue());
                
                Double previousValue = combinedClassProbabilities.getDouble(theClass);
                if(previousValue==null) { 
                    previousValue=0.0;
                }
                
                combinedClassProbabilities.put(theClass, previousValue+probability);
            }
        }
        
        return combinedClassProbabilities;
    }