src/Alg/Math/Algebra/GaussElimination.php
public function resolve( $matrix )
	{
		$lines	= $matrix->getRowNumber();
		$solution	= array();
		for( $i=$lines-1; $i>=0; $i-- )
		{
			for( $j=$lines-1; $j>=0; $j-- )
			{
				if( isset( $solution[$j] ) )
				{
					$var	= $solution[$j];
					$value	= $matrix->getValue( $i, $matrix->getColumnNumber()-1 ) - $var * $matrix->getValue( $i, $j );
					$matrix->setValue( $i, $matrix->getColumnNumber()-1, $value );
				}
				else
				{
					$factor	= $matrix->getValue( $i, $j );
					$value	= $matrix->getValue( $i, $matrix->getColumnNumber()-1 );
					$var		= $value / $factor;
					$solution[$j]	= $var;
					$solution[$j]	= round( $var, $this->accuracy );
					break;
				}
			}
		}
		ksort( $solution );
		$solution	= new Alg_Math_Algebra_Vector( array_values( $solution ) );
		return $solution;
	}
public function resolve( $matrix )
	{
		$lines	= $matrix->getRowNumber();
		$solution	= array();
		for( $i=$lines-1; $i>=0; $i-- )
		{
			for( $j=$lines-1; $j>=0; $j-- )
			{
				if( isset( $solution[$j] ) )
				{
					$var	= $solution[$j];
					$value	= $matrix->getValue( $i, $matrix->getColumnNumber()-1 ) - $var * $matrix->getValue( $i, $j );
					$matrix->setValue( $i, $matrix->getColumnNumber()-1, $value );
				}
				else
				{
					$factor	= $matrix->getValue( $i, $j );
					$value	= $matrix->getValue( $i, $matrix->getColumnNumber()-1 );
					$var		= $value / $factor;
					$solution[$j]	= $var;
					$solution[$j]	= round( $var, $this->accuracy );
					break;
				}
			}
		}
		ksort( $solution );
		$solution	= new Alg_Math_Algebra_Vector( array_values( $solution ) );
		return $solution;
	}
public function resolve ( $ matrix ) { $ lines = $ matrix -> getRowNumber ( ) ; $ solution = array ( ) ; for ( $ i = $ lines - 1 ; $ i >= 0 ; $ i -- ) { for ( $ j = $ lines - 1 ; $ j >= 0 ; $ j -- ) { if ( isset ( $ solution [ $ j ] ) ) { $ var = $ solution [ $ j ] ; $ value = $ matrix -> getValue ( $ i , $ matrix -> getColumnNumber ( ) - 1 ) - $ var * $ matrix -> getValue ( $ i , $ j ) ; $ matrix -> setValue ( $ i , $ matrix -> getColumnNumber ( ) - 1 , $ value ) ; } else { $ factor = $ matrix -> getValue ( $ i , $ j ) ; $ value = $ matrix -> getValue ( $ i , $ matrix -> getColumnNumber ( ) - 1 ) ; $ var = $ value / $ factor ; $ solution [ $ j ] = $ var ; $ solution [ $ j ] = round ( $ var , $ this -> accuracy ) ; break ; } } } ksort ( $ solution ) ; $ solution = new Alg_Math_Algebra_Vector ( array_values ( $ solution ) ) ; return $ solution ; }
Resolves eliminated Matrix and return Solution Vector.
@access		public
@param		Alg_Math_Algebra_Matrix		$matrix		Matrix to eliminate
@return		Alg_Math_Algebra_Vector
Resolves eliminated Matrix and return Solution Vector .