Returns Cross Product of two Vectors
@access		public
@param		Alg_Math_Algebra_Vector		$vector1		Vector 1
@param		Alg_Math_Algebra_Vector		$vector2		Vector 2
@return		Alg_Math_Algebra_Vector
185690
public function produce( $vector1, $vector2 )
	{
		if( $vector1->getDimension() != $vector2->getDimension() )
			throw new Exception( 'Dimensions of Vectors are not compatible.' );
		if( $vector1->getDimension() == 3 )
		{
			$x = $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 2 ) - $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 1 );
			$y = $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 0 ) - $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 2 );
			$z = $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 1 ) - $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 0 );
			$c = new Alg_Math_Algebra_Vector( $x, $y, $z );
		}
		return $c;
	}
1002022
def cross(self, vec):
        """"""
        if not isinstance(vec, Vector3Array):
            raise TypeError('Cross product operand must be a Vector3Array')
        if self.nV != 1 and vec.nV != 1 and self.nV != vec.nV:
            raise ValueError('Cross product operands must have the same '
                             'number of elements.')
        return Vector3Array(np.cross(self, vec))
434408
def normal
      vec1 = self.vertices[1] - self.vertices[0]
      vec2 = self.vertices[2] - self.vertices[0]
      return (vec1.cross(vec2).normalize)
    end
1175411
def angle(vec1, vec2):
        """"""
        dotp = Vector2.dot(vec1, vec2)
        mag1 = vec1.length()
        mag2 = vec2.length()
        result = dotp / (mag1 * mag2)
        return math.acos(result)
1206236
protected static function arrayMergeRecursive($array1, $array2)
	{
		if ( !is_array($array1) || !is_array($array2) ) {
			return $array2;
		}

		foreach ( $array2 as $array2_key => $array2_value ) {
			if ( isset($array1[$array2_key]) ) {
				$array1[$array2_key] = self::arrayMergeRecursive($array1[$array2_key], $array2_value);
			}
			else {
				$array1[$array2_key] = $array2_value;
			}
		}

		return $array1;
	}
669656
private static double dot(double vector1[], double vector2[]) {

        double product = 0;
        assert vector1.length == vector2.length;
        for (int i = 0; i < vector1.length; i++) {
            product += vector1[i] * vector2[i];
        }
        return product;

    }
512975
public function bitXor( $value1, $value2 )
    {
        $value1 = $this->getIdentifier( $value1 );
        $value2 = $this->getIdentifier( $value2 );
        return "( {$value1} + {$value2} - bitand( {$value1}, {$value2} ) * 2 )";
    }
1355215
public static double mul(Double v1, Double v2) {
		return mul((Number) v1, (Number) v2).doubleValue();
	}
100162
public function project(Vector $b) : self
    {
        $bHat = $this->dot($b) / ($b->l2Norm() ** 2);

        return $b->multiply($bHat);
    }
1124521
public Vector2i mul(int scalar, Vector2i dest) {
        dest.x = x * scalar;
        dest.y = y * scalar;
        return dest;
    }
1328798
public static function mul($float1, $float2)
    {
        if (!static::is($float1) || !static::is($float2)) {
            throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float.");
        }

        return ($float1 * $float2);
    }
722020
public static function MMULT($matrixData1, $matrixData2)
    {
        $matrixAData = $matrixBData = array();
        if (!is_array($matrixData1)) {
            $matrixData1 = array(array($matrixData1));
        }
        if (!is_array($matrixData2)) {
            $matrixData2 = array(array($matrixData2));
        }

        try {
            $rowA = 0;
            foreach ($matrixData1 as $matrixRow) {
                if (!is_array($matrixRow)) {
                    $matrixRow = array($matrixRow);
                }
                $columnA = 0;
                foreach ($matrixRow as $matrixCell) {
                    if ((!is_numeric($matrixCell)) || ($matrixCell === null)) {
                        return PHPExcel_Calculation_Functions::VALUE();
                    }
                    $matrixAData[$rowA][$columnA] = $matrixCell;
                    ++$columnA;
                }
                ++$rowA;
            }
            $matrixA = new PHPExcel_Shared_JAMA_Matrix($matrixAData);
            $rowB = 0;
            foreach ($matrixData2 as $matrixRow) {
                if (!is_array($matrixRow)) {
                    $matrixRow = array($matrixRow);
                }
                $columnB = 0;
                foreach ($matrixRow as $matrixCell) {
                    if ((!is_numeric($matrixCell)) || ($matrixCell === null)) {
                        return PHPExcel_Calculation_Functions::VALUE();
                    }
                    $matrixBData[$rowB][$columnB] = $matrixCell;
                    ++$columnB;
                }
                ++$rowB;
            }
            $matrixB = new PHPExcel_Shared_JAMA_Matrix($matrixBData);

            if ($columnA != $rowB) {
                return PHPExcel_Calculation_Functions::VALUE();
            }

            return $matrixA->times($matrixB)->getArray();
        } catch (PHPExcel_Exception $ex) {
            var_dump($ex->getMessage());
            return PHPExcel_Calculation_Functions::VALUE();
        }
    }
374843
def cross_product(self, p1, p2):
        """"""
        return (p1.x * p2.y - p1.y * p2.x)
700286
def cross(b,c)
        unless b.size == 3 and c.size == 3
          raise "Vectors must be of length 3"
        end
        Vector[b[1]*c[2] - b[2]*c[1], b[2]*c[0] - b[0]*c[2], b[0]*c[1] - b[1]*c[0]]
      end
1252899
def from_two_vectors(self, vec1, vec2):
        ''''''
        angle = vec1.angle(vec2)
        cross = vec1 % vec2
        if cross.length() == 0:
            # the two vectors are colinear
            return self.from_euler(0,0,angle)
        cross.normalize()
        return self.from_axis_angle(cross, angle)
1073409
public double innerproduct(double[] vec1, double[] vec2) {
    double sum = 0;

    for (int i = 0; i < vec1.length; i++) {
      sum += vec1[i] * vec2[i];
    }

    return sum;
  }
1189783
def cross(a, b):
    """
    if isinstance(a, Mul):
        a = a.expand()
        avect = 1
        aivect = -1
        for ai, fact in enumerate(a.args):
            if isinstance(fact, Vector3D):
                avect = fact
                aivect = ai
                break

        acoef = a.args[:aivect] + a.args[aivect+1:]
        acoef = Mul(*acoef)
        return acoef*cross(avect, b)

    if isinstance(b, Mul):
        b = b.expand()
        bvect = 1
        bivect = -1
        for bi, fact in enumerate(b.args):
            if isinstance(fact, Vector3D):
                bvect = fact
                bivect = bi
                break

        bcoef = b.args[:bivect] + b.args[bivect+1:]
        bcoef = Mul(*bcoef)
        return bcoef*cross(a, bvect)

    if isinstance(a, Vector3D) and isinstance(b, Vector3D):
        return CrossProduct(a, b)