Calculates the cross product of this {@link Vector} with a given <code>Vector</code>.

@param v the vector
499833
public void cross(Vector v)
	{
		x = (y * v.z) - (z * v.y);
		y = (z * v.x) - (x * v.z);
		z = (x * v.y) - (y * v.x);
	}
530149
public double dot(IntDoubleVector y) {
        if (y instanceof IntDoubleSortedVector) {
            IntDoubleSortedVector other = ((IntDoubleSortedVector) y);
            double 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 {
            double dot = 0;
            for (int c = 0; c < used; c++) {
                dot += this.values[c] * y.get(indices[c]);
            }
            return dot;
        }
    }
844286
public void max(double v) {
    if (Double.isFinite(v)) {
      double max = get();
      while (isGreaterThan(v, max) && !compareAndSet(max, v)) {
        max = value.get();
      }
    }
  }
87300
public double distance(Vector4ic v) {
        return distance(v.x(), v.y(), v.z(), v.w());
    }
699757
public double dot(Vector4dc v) {
        return dot(v.x(), v.y(), v.z(), v.w());
    }
254072
public float dot(Vector3fc v) {
        return dot(v.x(), v.y(), v.z());
    }
895502
public RowVector multiply(RowVector rv) throws MatrixException
    {
        // Validate rv's size.
        if (nCols != rv.nCols) {
            throw new MatrixException(
                                MatrixException.INVALID_DIMENSIONS);
        }

        double pv[] = new double[nRows];  // product values

        // Compute the values of the product.
        for (int c = 0; c < nCols; ++c) {
            double dot = 0;
            for (int r = 0; r < nRows; ++r) {
                dot += rv.values[0][r] * values[r][c];
            }
            pv[c] = dot;
        }

        return new RowVector(pv);
    }
879603
public static double sumOfSquares(NumberVector v) {
    final int dim = v.getDimensionality();
    double sum = 0;
    for(int d = 0; d < dim; d++) {
      double x = v.doubleValue(d);
      sum += x * x;
    }
    return sum;
  }
954431
public Vector3f mul(Vector3fc v, Vector3f dest) {
        dest.x = x * v.x();
        dest.y = y * v.y();
        dest.z = z * v.z();
        return dest;
    }
739408
public double distance(Vector3d v) {
        double dx = x - v.x;
        double dy = y - v.y;
        double dz = z - v.z;

        return Math.sqrt(dx * dx + dy * dy + dz * dz);
    }
940789
public void setVariable(ElemVariable v)
  {

    if (null == m_topLevelVariables)
      m_topLevelVariables = new Vector();

    m_topLevelVariables.addElement(v);
  }
1299337
public double angle(Vector4dc v) {
        double cos = angleCos(v);
        // This is because sometimes cos goes above 1 or below -1 because of lost precision
        cos = cos < 1 ? cos : 1;
        cos = cos > -1 ? cos : -1;
        return Math.acos(cos);
    }
560309
public double dot(Vector other) {
        return x * other.x + y * other.y + z * other.z;
    }
606774
def vector_cross(vector1, vector2):
    
    try:
        if vector1 is None or len(vector1) == 0 or vector2 is None or len(vector2) == 0:
            raise ValueError("Input vectors cannot be empty")
    except TypeError as e:
        print("An error occurred: {}".format(e.args[-1]))
        raise TypeError("Input must be a list or tuple")
    except Exception:
        raise

    if not 1 < len(vector1) <= 3 or not 1 < len(vector2) <= 3:
        raise ValueError("The input vectors should contain 2 or 3 elements")

    # Convert 2-D to 3-D, if necessary
    if len(vector1) == 2:
        v1 = [float(v) for v in vector1] + [0.0]
    else:
        v1 = vector1

    if len(vector2) == 2:
        v2 = [float(v) for v in vector2] + [0.0]
    else:
        v2 = vector2

    # Compute cross product
    vector_out = [(v1[1] * v2[2]) - (v1[2] * v2[1]),
                  (v1[2] * v2[0]) - (v1[0] * v2[2]),
                  (v1[0] * v2[1]) - (v1[1] * v2[0])]

    # Return the cross product of the input vectors
    return vector_out
134310
public double angle(Vector3dc v) {
        double cos = angleCos(v);
        // This is because sometimes cos goes above 1 or below -1 because of lost precision
        cos = cos < 1 ? cos : 1;
        cos = cos > -1 ? cos : -1;
        return Math.acos(cos);
    }
534652
public Vector3f cross(float x, float y, float z) {
        return cross(x, y, z, thisOrNew());
    }
510117
public double dot(Vector b) {
        if ((b == null) || (size != b.size)) return Double.NaN;

        double result = 0;
        int i;
        for (i = 0; i < size; i++)
            result += vector[i] * b.vector[i];
        return result;
    }

    /**
     * Cross product, only well definited in R^3
     */
    public Vector cross(Vector b) {
        if ((b == null) || (size != 3) || (b.size != 3)) return null;

        Vector result = new Vector(3);
        result.vector[0] = vector[1] * b.vector[2] - vector[2] * b.vector[1];
        result.vector[1] = vector[2] * b.vector[0] - vector[0] * b.vector[2];
        result.vector[2] = vector[0] * b.vector[1] - vector[1] * b.vector[0];
        return result;
    }

    /**
     * Return the length from this vector
     */
    public double length() {
        double value = 0;
        for (int i = 0; i < size; i++)
            value += vector[i] * vector[i];
        return Math.sqrt(value);
    }

    /**
     * Normalize this vector
     */
    public Vector normalize() {
        Vector result = new Vector(size);
        double length = length();
        for (int i = 0; i < size; i++)
            result.vector[i] = vector[i] / length;
        return result;
    }

    /**
     * Negates this vector
     */
    public Vector negate() {
        Vector result = new Vector(size);
        for (int i = 0; i < size; i++)
            result.vector[i] = -vector[i];
        return result;
    }

    /**
     *  Copy a vector
     */
    public Vector duplicate() {
        Vector result = new Vector(size);
        int i;
        for (i = 0; i < size; i++)
            result.vector[i] = vector[i];
        return result;
    }

    /**
     *  Return a vector as a string
     */
    @Override
    public String toString() {
        int i;
        StringBuffer str = new StringBuffer();
        str.append("[ ");
        for (i = 0; i < (size - 1); i++)
            str.append(vector[i] + " ");
        str.append(vector[size - 1] + " ]");
        return str.toString();
    }
}