src/Alg/Math/Algebra/Matrix.php
public function swapColumns( $column1, $column2 )
	{
		if( $column1 < 0 || $column1 >= $this->getColumnNumber() )
			throw new OutOfRangeException( 'Column key "'.$column1.'" is not valid.' );
		if( $column2 < 0 || $column2 >= $this->getColumnNumber() )
			throw new OutOfRangeException( 'Column key "'.$column2.'" is not valid.' );

		for( $row = 0; $row < $this->getRowNumber(); $row++ )
		{
			$buffer	= $this->values[$row][$column1];
			$this->values[$row][$column1]	= $this->values[$row][$column2];
			$this->values[$row][$column2]	= $buffer;
		}
	}
public function swapColumns( $column1, $column2 )
	{
		if( $column1 < 0 || $column1 >= $this->getColumnNumber() )
			throw new OutOfRangeException( 'Column key "'.$column1.'" is not valid.' );
		if( $column2 < 0 || $column2 >= $this->getColumnNumber() )
			throw new OutOfRangeException( 'Column key "'.$column2.'" is not valid.' );

		for( $row = 0; $row < $this->getRowNumber(); $row++ )
		{
			$buffer	= $this->values[$row][$column1];
			$this->values[$row][$column1]	= $this->values[$row][$column2];
			$this->values[$row][$column2]	= $buffer;
		}
	}
public function swapColumns ( $ column1 , $ column2 ) { if ( $ column1 < 0 || $ column1 >= $ this -> getColumnNumber ( ) ) throw new OutOfRangeException ( 'Column key "' . $ column1 . '" is not valid.' ) ; if ( $ column2 < 0 || $ column2 >= $ this -> getColumnNumber ( ) ) throw new OutOfRangeException ( 'Column key "' . $ column2 . '" is not valid.' ) ; for ( $ row = 0 ; $ row < $ this -> getRowNumber ( ) ; $ row ++ ) { $ buffer = $ this -> values [ $ row ] [ $ column1 ] ; $ this -> values [ $ row ] [ $ column1 ] = $ this -> values [ $ row ] [ $ column2 ] ; $ this -> values [ $ row ] [ $ column2 ] = $ buffer ; } }
Swaps 2 Columns within Matrix.
@access		public
@param		int			$column1		Index of Source Column
@param		int			$column2		Index of Target Column
@return		void
Swaps 2 Columns within Matrix .