Raw pointwise multiplication of two elements.
774074
def _divide(self, x1, x2, out):
        """"""
        self.tspace._divide(x1.tensor, x2.tensor, out.tensor)
669206
function matmul(A, B) {
    var shapeA = A.shape;
    var shapeB = B.shape;
    if (shapeA.length > 2 || shapeB.length > 2) {
        throw new Error('Array shape is > 2D, not suitable for ' +
            'matrix multiplication');
    }
    // Treat a flat n-item array as 1xn matrix
    if (shapeA.length === 1) {
        shapeA = [1, shapeA[0]];
    }
    if (shapeB.length === 1) {
        shapeB = [1, shapeB[0]];
    }
    if (shapeA[1] !== shapeB[0]) {
        throw new Error('Matrix shapes ' + shapeA.join('x') + ' and ' +
            shapeB.join('x') + ' not compatible for multiplication');
    }
    // If one of the matrices is flat n-item array clone them into 1xn NDArray
    var mA, mB;
    if (A.shape.length === 1) {
        mA = A.clone();
        mA.reshape([1, A.shape[0]]);
    }
    else {
        mA = A;
    }
    if (B.shape.length === 1) {
        mB = B.clone();
        mB.reshape([1, B.shape[0]]);
    }
    else {
        mB = B;
    }
    var result = new common_1.NDArray({ shape: [mA.shape[0], mB.shape[1]] });
    for (var i = 0; i < mA.shape[0]; i++) {
        for (var j = 0; j < mB.shape[1]; j++) {
            var value = 0.0;
            for (var k = 0; k < mA.shape[1]; k++) {
                value += A.get(i, k) * B.get(k, j); // TODO:Complex
            }
            result.set(i, j, value);
        }
    }
    return result;
}
1206678
function sub(a, b){
    return Vector3(a.x-b.x, a.y-b.y, a.z-b.z);
  }
807931
private static Vector2d getPerpendicular(Tuple2d a, Tuple2d b, Vector2d ref) {
        final Vector2d pVec = new Vector2d(-(a.y-b.y), a.x-b.x);
        if (pVec.dot(ref) < 0)
            pVec.negate();
        return pVec;
    }
120174
def _multiply(self, f1, f2, out):
        
        # Avoid infinite recursions by making a copy of the functions
        f1_copy = f1.copy()
        f2_copy = f2.copy()

        def product_oop(x, **kwargs):
            """Product out-of-place evaluation function."""
            return np.asarray(f1_copy(x, **kwargs) * f2_copy(x, **kwargs),
                              dtype=self.scalar_out_dtype)

        out._call_out_of_place = product_oop
        decorator = preload_first_arg(out, 'in-place')
        out._call_in_place = decorator(_default_in_place)
        out._call_has_out = out._call_out_optional = False
        return out
447412
public static IntPoint Multiply(IntPoint point1, IntPoint point2) {
        IntPoint result = new IntPoint(point1);
        result.Multiply(point2);
        return result;
    }
211631
def pairwise(values):
    
    i = iter(values)
    a = next(i)

    for b in i:
        yield (a, b)
        a = b
379728
function aug(a, b) {
    var newarr = [];
    for (var i = 0; i < a.length; i++) {
      newarr.push(a[i].slice());
    }
    for (var i = 0; i < newarr.length; i++) {
      push.apply(newarr[i], b[i]);
    }
    return newarr;
  }
714193
private void ssMergeForward(int PA, int first, int middle, int last, int buf,
                                int depth) {
        // PA, first, middle, last, buf are pointers to SA
        int a, b, c, bufend;// pointers to SA
        int t, r;

        bufend = buf + (middle - first) - 1;
        ssBlockSwap(buf, first, middle - first);

        for (t = SA[a = first], b = buf, c = middle; ; ) {
            r = ssCompare(PA + SA[b], PA + SA[c], depth);
            if (r < 0) {
                do {
                    SA[a++] = SA[b];
                    if (bufend <= b) {
                        SA[bufend] = t;
                        return;
                    }
                    SA[b++] = SA[a];
                }
                while (SA[b] < 0);
            } else if (r > 0) {
                do {
                    SA[a++] = SA[c];
                    SA[c++] = SA[a];
                    if (last <= c) {
                        while (b < bufend) {
                            SA[a++] = SA[b];
                            SA[b++] = SA[a];
                        }
                        SA[a] = SA[b];
                        SA[b] = t;
                        return;
                    }
                }
                while (SA[c] < 0);
            } else {
                SA[c] = ~SA[c];
                do {
                    SA[a++] = SA[b];
                    if (bufend <= b) {
                        SA[bufend] = t;
                        return;
                    }
                    SA[b++] = SA[a];
                }
                while (SA[b] < 0);

                do {
                    SA[a++] = SA[c];
                    SA[c++] = SA[a];
                    if (last <= c) {
                        while (b < bufend) {
                            SA[a++] = SA[b];
                            SA[b++] = SA[a];
                        }
                        SA[a] = SA[b];
                        SA[b] = t;
                        return;
                    }
                }
                while (SA[c] < 0);
            }
        }

    }
1322281
def combine_elem(ind1, ind2):
    """"""
    def inner(seq):
        shift = 2**16
        if seq[ind1] < 0:
            seq[ind1] += shift
        if seq[ind2] < 0:
            seq[ind2] += shift
        return (seq[ind1] << 16) | seq[ind2]
    return inner
119771
def _inner(self, x, y):
        """"""
        if self.is_uniform and not self.is_uniformly_weighted:
            # TODO: implement without copying x
            bdry_fracs = self.partition.boundary_cell_fractions
            func_list = _scaling_func_list(bdry_fracs, exponent=1.0)
            x_arr = apply_on_boundary(x, func=func_list, only_once=False)
            return super(DiscreteLp, self)._inner(self.element(x_arr), y)
        else:
            return super(DiscreteLp, self)._inner(x, y)
711706
function(a, b){
			return (a._x < b._x + b._w && a._y < b._y + b._h 
					&& a._x + a._w > b._x && a._y + a._h > b._y)
		}
585804
private void mmuli(int n, double[] A, double[] B, double[] C) {
        for (int i = 0; i < n * n; i++) {
            C[i] = 0;
        }

        for (int j = 0; j < n; j++) {
            int jn = j * n;
            for (int k = 0; k < n; k++) {
                int kn = k * n;
                double bkjn = B[k + jn];
                for (int i = 0; i < n; i++) {
                    C[i + jn] += A[i + kn] * bkjn;
                }
            }
        }
    }
1028789
def split(self, t):
        """"""
        bpoints1, bpoints2 = split_bezier(self.bpoints(), t)
        return CubicBezier(*bpoints1), CubicBezier(*bpoints2)
1149120
def matrix_multiplication_blockwise(self, matrix, blocksize):
        
        #Create the blockwise version of self and matrix
        selfBlockwise = self.matrix_to_blockmatrix(blocksize)
        matrixBlockwise = matrix.matrix_to_blockmatrix(blocksize)

        return (selfBlockwise * matrixBlockwise).flatten()
823057
def mul(*args):
    """"""
    if len(args) > 2:
        return add(args[0], add(args[1], args[1:]))

    if len(args) == 1:
        return args[0]

    part1, part2 = args

    if not isinstance(part2, Poly):

        if isinstance(part2, (float, int)):
            part2 = np.asarray(part2)

        if not part2.shape:
            core = part1.A.copy()
            dtype = chaospy.poly.typing.dtyping(
                part1.dtype, part2.dtype)
            for key in part1.keys:
                core[key] = np.asarray(core[key]*part2, dtype)
            return Poly(core, part1.dim, part1.shape, dtype)

        part2 = Poly(part2)

    if part2.dim > part1.dim:
        part1 = chaospy.dimension.setdim(part1, part2.dim)

    elif part2.dim < part1.dim:
        part2 = chaospy.dimension.setdim(part2, part1.dim)

    if np.prod(part1.shape) >= np.prod(part2.shape):
        shape = part1.shape
    else:
        shape = part2.shape

    dtype = chaospy.poly.typing.dtyping(part1.dtype, part2.dtype)
    if part1.dtype != part2.dtype:

        if part1.dtype == dtype:
            part2 = chaospy.poly.typing.asfloat(part2)

        else:
            part1 = chaospy.poly.typing.asfloat(part1)

    core = {}
    for idx1 in part2.A:
        for idx2 in part1.A:
            key = tuple(np.array(idx1) + np.array(idx2))
            core[key] = np.asarray(
                core.get(key, 0) + part2.A[idx1]*part1.A[idx2])
    core = {key: value for key, value in core.items() if np.any(value)}

    out = Poly(core, part1.dim, shape, dtype)
    return out
984129
def xor(a, b):
        """"""
        return bytearray(i ^ j for i, j in zip(a, b))