Gets the entrywise sum of the two vectors.
358515
public IntIntSortedVector getSum(IntIntVector other) {
        IntIntSortedVector sum = new IntIntSortedVector(this);
        sum.add(other);
        return sum;
    }
793538
function add(a, b){
    return Vector3(a.x+b.x, a.y+b.y, a.z+b.z);
  }
356090
def get_sum_w2(self, ix, iy=0, iz=0):
        
        if self.GetSumw2N() == 0:
            raise RuntimeError(
                "Attempting to access Sumw2 in histogram "
                "where weights were not stored")
        xl = self.nbins(axis=0, overflow=True)
        yl = self.nbins(axis=1, overflow=True)
        idx = xl * yl * iz + xl * iy + ix
        if not 0 <= idx < self.GetSumw2N():
            raise IndexError("bin index out of range")
        return self.GetSumw2().At(idx)
478098
public double sum(final float b)
  {
    if (b < min) {
      return 0;
    }
    if (b >= max) {
      return count;
    }

    int index = Arrays.binarySearch(positions, 0, binCount, b);
    boolean exactMatch = index >= 0;
    index = exactMatch ? index : -(index + 1);

    // we want positions[index] <= b < positions[index+1]
    if (!exactMatch) {
      index--;
    }

    final boolean outerLeft = index < 0;
    final boolean outerRight = index >= (binCount - 1);

    final long m0 = outerLeft ? 0 : (bins[index] & COUNT_BITS);
    final long m1 = outerRight ? 0 : (bins[index + 1] & COUNT_BITS);
    final double p0 = outerLeft ? min : positions[index];
    final double p1 = outerRight ? max : positions[index + 1];
    final boolean exact0 = (!outerLeft && (bins[index] & APPROX_FLAG_BIT) == 0);
    final boolean exact1 = (!outerRight && (bins[index + 1] & APPROX_FLAG_BIT) == 0);

    // handle case when p0 = p1, which happens if the first bin = min or the last bin = max
    final double l = (p1 == p0) ? 0 : (b - p0) / (p1 - p0);

    // don't include exact counts in the trapezoid calculation
    long tm0 = m0;
    long tm1 = m1;
    if (exact0) {
      tm0 = 0;
    }
    if (exact1) {
      tm1 = 0;
    }
    final double mb = tm0 + (tm1 - tm0) * l;
    double s = 0.5 * (tm0 + mb) * l;

    for (int i = 0; i < index; ++i) {
      s += (bins[i] & COUNT_BITS);
    }

    // add full bin count if left bin count is exact
    if (exact0) {
      return (s + m0);
    } else {
      // otherwise add only the left half of the bin
      return (s + 0.5 * m0);
    }
  }
946101
public static double[] pairwiseMin (double[] vector1, double[] vector2) {
        // Initialize the return value:
        final double[] retval = new double[vector1.length];

        // Iterate over values and get mins:
        for (int i = 0; i < retval.length; i++) {
            retval[i] = Math.min(vector1[i], vector2[i]);
        }

        // Done, return:
        return retval;
    }
680894
def dot(vec1, vec2):
        """"""
        if isinstance(vec1, Vector2) \
                and isinstance(vec2, Vector2):
            return ((vec1.X * vec2.X) + (vec1.Y * vec2.Y))
        else:
            raise TypeError("vec1 and vec2 must be Vector2's")
1080422
@javax.annotation.Nonnull
  public static double[] sum(@javax.annotation.Nonnull final double[] a, final double b) {
    return com.simiacryptus.util.ArrayUtil.op(a, (x) -> x + b);
  }
618966
def sum(self):
        
        return self._constructor(self.values.sum(axis=self.baseaxes, keepdims=True))
131080
def Sum(a, axis, keep_dims):
    
    return np.sum(a, axis=axis if not isinstance(axis, np.ndarray) else tuple(axis),
                  keepdims=keep_dims),
1347808
public int dot(IntIntVector y) {
        if (y instanceof IntIntSortedVector) {
            IntIntSortedVector other = ((IntIntSortedVector) y);
            int dot = 0;
            int oc = 0;
            for (int c = 0; c < used; c++) {
                while (oc < other.used) {
                    if (other.indices[oc] < indices[c]) {
                        oc++;
                    } else if (indices[c] == other.indices[oc]) {
                        dot += values[c] * other.values[oc];
                        break;
                    } else {
                        break;
                    }
                }
            }
            return dot;
        } else {
            int dot = 0;
            for (int c = 0; c < used; c++) {
                dot += this.values[c] * y.get(indices[c]);
            }
            return dot;
        }
    }
1164346
def sum(self, vector):
        """"""
        return self.from_list(
            [x + vector.vector[i] for i, x in self.to_list()]
        )
264317
def _sumLists(a, b):
    
    val = 0
    for i in map(lambda a, b: a * b, a, b):
        val += i
    return val
944701
public static int sum( InterleavedS16 img ) {

		if( BoofConcurrency.USE_CONCURRENT ) {
			return ImplImageStatistics_MT.sum(img);
		} else {
			return ImplImageStatistics.sum(img);
		}
	}
421147
function sum(input, initial) {

    return (!isArray(input)) ? input :
        input.reduce(function(prev, curr) {
            return prev + curr;
        }, initial || 0);
}
654849
public static int sum( InterleavedS32 img ) {

		if( BoofConcurrency.USE_CONCURRENT ) {
			return ImplImageStatistics_MT.sum(img);
		} else {
			return ImplImageStatistics.sum(img);
		}
	}
782716
public IntFloatSortedVector getProd(IntFloatVector other) {
        IntFloatSortedVector prod = new IntFloatSortedVector(this);
        prod.product(other);
        return prod;
    }
456204
public static float Sum(float[] data) {
        float sum = 0;
        for (int i = 0; i < data.length; i++) {
            sum += data[i];
        }
        return sum;
    }