Return the perp product of the given vectors.  The perp product is
        just a cross product where the third dimension is taken to be zero and
        the result is returned as a scalar.
12972
def perp_product(self, other):
        

        return self.x * other.y - self.y * other.x
913381
function mul(a, b){
    return Vector3(a.x*b.x, a.y*b.y, a.z*b.z);
  }
4209
public Vector4d mul(double scalar, Vector4d dest) {
        dest.x = x * scalar;
        dest.y = y * scalar;
        dest.z = z * scalar;
        dest.w = w * scalar;
        return dest;
    }
783735
def vector(x, y=None, z=0.0):
    
    if y is None:  # assume x is already [x,y,z]
        return np.array(x, dtype=np.float64)
    return np.array([x, y, z], dtype=np.float64)
378482
public Vector3d hermite(Vector3dc t0, Vector3dc v1, Vector3dc t1, double t, Vector3d dest) {
        double t2 = t * t;
        double t3 = t2 * t;
        dest.x = (x + x - v1.x() - v1.x() + t1.x() + t0.x()) * t3 + (3.0 * v1.x() - 3.0 * x - t0.x() - t0.x() - t1.x()) * t2 + x * t + x;
        dest.y = (y + y - v1.y() - v1.y() + t1.y() + t0.y()) * t3 + (3.0 * v1.y() - 3.0 * y - t0.y() - t0.y() - t1.y()) * t2 + y * t + y;
        dest.z = (z + z - v1.z() - v1.z() + t1.z() + t0.z()) * t3 + (3.0 * v1.z() - 3.0 * z - t0.z() - t0.z() - t1.z()) * t2 + z * t + z;
        return dest;
    }
413121
def operator(self):
        
        # is projection the zero operator?
        if self.V.shape[1] == 0:
            N = self.V.shape[0]
            return ZeroLinearOperator((N, N))
        return self._get_operator(self.apply, self.apply_adj)
1160151
def dot_product(self, other):
        
        return self.x * other.x + self.y * other.y
229808
public Vector3f orthogonalize(Vector3fc v, Vector3f dest) {
        /*
         * http://lolengine.net/blog/2013/09/21/picking-orthogonal-vector-combing-coconuts
         */
        float rx, ry, rz;
        if (Math.abs(v.x()) > Math.abs(v.z())) {
            rx = -v.y();
            ry = v.x();
            rz = 0.0f;
        } else {
            rx = 0.0f;
            ry = -v.z();
            rz = v.y();
        }
        float invLen = 1.0f / (float) Math.sqrt(rx * rx + ry * ry + rz * rz);
        dest.x = rx * invLen;
        dest.y = ry * invLen;
        dest.z = rz * invLen;
        return dest;
    }
1012089
def getvector(d,s):
    '''
    
    '''
    return np.array([d[s+"x"],d[s+"y"],d[s+"z"]]);
316982
def get_angle_between(self, other):
        """"""
        # The scalar product is the sum of the squares of the
        # magnitude times the cosine of the angle - so normalizing the
        # vectors first means the scalar product is just the cosine of
        # the angle.
        normself = self.get_normalized()
        normother = other.get_normalized()
        sp = normself.get_scalar_product(normother)
        return math.acos(sp)
1228218
def *(x)
      x = Unit.cast(x)
      if scalar?
        return x
      elsif x.scalar?
        return self.dup
      end
      check_operable2(x)
      dims = dimension_binop(x){|a,b| a+b}
      factor = self.factor * x.factor
      Unit.new(factor,dims)
    end
680294
def isvector_or_scalar(a):
    
    try:
        return a.size and a.ndim-a.shape.count(1) <= 1
    except:
        return False
479752
def to_affine(self):
        
        X, Y, Z = self.x, self.y, self.inverse(self.z)
        return ((X * Z ** 2) % P, (Y * Z ** 3) % P)
208203
def phi(v):
    
    v = np.atleast_2d(v)
    dir_x = v[:, 0]
    dir_y = v[:, 1]
    return phi_separg(dir_x, dir_y)
527915
private static double[] crossProduct(double[] u, double[] v) {
        return new double[]{(u[1] * v[2]) - (v[1] * u[2]), (u[2] * v[0]) - (v[2] * u[0]), (u[0] * v[1]) - (v[0] * u[1])};
    }
310428
def normalize_vector(vector):
    
    v = np.divide(vector, np.linalg.norm(vector))
    return np.round(v, decimals=4)
984843
def hash_vector(self, v, querying=False):
        
        if scipy.sparse.issparse(v):
            # If vector is sparse, make sure we have the CSR representation
            # of the projection matrix
            if self.normals_csr == None:
                self.normals_csr = scipy.sparse.csr_matrix(self.normals)
            # Make sure that we are using CSR format for multiplication
            if not scipy.sparse.isspmatrix_csr(v):
                v = scipy.sparse.csr_matrix(v)
            # Project vector onto all hyperplane normals
            projection = self.normals_csr.dot(v)
        else:
            # Project vector onto all hyperplane normals
            projection = numpy.dot(self.normals, v)

        # Build binary key
        binary_key = ''.join(['1' if x > 0.0 else '0' for x in projection])

        if querying:
            #print 'Querying...'
            # Make sure returned buckets keys contain at least N results
            return self.tree_root.bucket_keys_to_guarantee_result_set_size(binary_key, self.minimum_result_size, 0)
        else:
            # We are indexing, so adapt bucket key counter in binary tree
            self.tree_root.insert_entry_for_bucket(binary_key, 0)

            # Return binary key
            return [binary_key]