src/Alg/Math/Algebra/Vector/ScalarProduct.php
public function produce( $vector1, $vector2 )
	{
		$sum = 0;
		if( $vector1->getDimension() != $vector2->getDimension() )
			throw new Exception( 'Dimensions of Vectors are not compatible.' );

		for( $i=0; $i<$vector1->getDimension(); $i++)
			$sum += $vector1->getValueFromIndex( $i ) * $vector2->getValueFromIndex( $i );
		return $sum;
	}
public function produce( $vector1, $vector2 )
	{
		$sum = 0;
		if( $vector1->getDimension() != $vector2->getDimension() )
			throw new Exception( 'Dimensions of Vectors are not compatible.' );

		for( $i=0; $i<$vector1->getDimension(); $i++)
			$sum += $vector1->getValueFromIndex( $i ) * $vector2->getValueFromIndex( $i );
		return $sum;
	}
public function produce ( $ vector1 , $ vector2 ) { $ sum = 0 ; if ( $ vector1 -> getDimension ( ) != $ vector2 -> getDimension ( ) ) throw new Exception ( 'Dimensions of Vectors are not compatible.' ) ; for ( $ i = 0 ; $ i < $ vector1 -> getDimension ( ) ; $ i ++ ) $ sum += $ vector1 -> getValueFromIndex ( $ i ) * $ vector2 -> getValueFromIndex ( $ i ) ; return $ sum ; }
Returns Scalar Product of two Vectors
@access		public
@param		Alg_Math_Algebra_Vector		$vector1		Vector 1
@param		Alg_Math_Algebra_Vector		$vector2		Vector 2
@return		mixed
Returns Scalar Product of two Vectors