See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]
1 <?php 2 3 namespace Matrix\Operators; 4 5 use Matrix\Div0Exception; 6 use Matrix\Exception; 7 use \Matrix\Matrix; 8 use \Matrix\Functions; 9 10 class Division extends Multiplication 11 { 12 /** 13 * Execute the division 14 * 15 * @param mixed $value The matrix or numeric value to divide the current base value by 16 * @throws Exception If the provided argument is not appropriate for the operation 17 * @return $this The operation object, allowing multiple divisions to be chained 18 **/ 19 public function execute($value, string $type = 'division'): Operator 20 { 21 if (is_array($value)) { 22 $value = new Matrix($value); 23 } 24 25 if (is_object($value) && ($value instanceof Matrix)) { 26 $value = Functions::inverse($value, $type); 27 28 return $this->multiplyMatrix($value, $type); 29 } elseif (is_numeric($value)) { 30 return $this->multiplyScalar(1 / $value, $type); 31 } 32 33 throw new Exception('Invalid argument for division'); 34 } 35 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body