public function plus()
    {
        if (func_num_args() > 0) {
            $args = func_get_args();
            $match = implode(',', array_map('gettype', $args));
 
            switch ($match) {
        case 'object':
          $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR);
          //$this->checkMatrixDimensions($M);
 
          for ($i = 0; $i < $this->m; $i++) {
              for ($j = 0; $j < $this->n; $j++) {
                  $M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]);
              }
          }
 
          return $M;
          break;
 
        case 'array':
          $M = new Matrix($args[0]);
          //$this->checkMatrixDimensions($M);
 
          for ($i = 0; $i < $this->m; $i++) {
              for ($j = 0; $j < $this->n; $j++) {
                  $M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]);
              }
          }
 
          return $M;
          break;
 
        default:
          trigger_error(PolymorphicArgumentException, ERROR);
          break;
      }
        } else {
            trigger_error(PolymorphicArgumentException, ERROR);
        }
    }
public function plus()
    {
        if (func_num_args() > 0) {
            $args = func_get_args();
            $match = implode(',', array_map('gettype', $args));
 
            switch ($match) {
        case 'object':
          $M = is_a($args[0], 'Matrix') ? $args[0] : trigger_error(ArgumentTypeException, ERROR);
          //$this->checkMatrixDimensions($M);
 
          for ($i = 0; $i < $this->m; $i++) {
              for ($j = 0; $j < $this->n; $j++) {
                  $M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]);
              }
          }
 
          return $M;
          break;
 
        case 'array':
          $M = new Matrix($args[0]);
          //$this->checkMatrixDimensions($M);
 
          for ($i = 0; $i < $this->m; $i++) {
              for ($j = 0; $j < $this->n; $j++) {
                  $M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]);
              }
          }
 
          return $M;
          break;
 
        default:
          trigger_error(PolymorphicArgumentException, ERROR);
          break;
      }
        } else {
            trigger_error(PolymorphicArgumentException, ERROR);
        }
    }
public function plus ( ) { if ( func_num_args ( ) > 0 ) { $ args = func_get_args ( ) ; $ match = implode ( ',' , array_map ( 'gettype' , $ args ) ) ; switch ( $ match ) { case 'object' : $ M = is_a ( $ args [ 0 ] , 'Matrix' ) ? $ args [ 0 ] : trigger_error ( ArgumentTypeException , ERROR ) ; //$this->checkMatrixDimensions($M); for ( $ i = 0 ; $ i < $ this -> m ; $ i ++ ) { for ( $ j = 0 ; $ j < $ this -> n ; $ j ++ ) { $ M -> set ( $ i , $ j , $ M -> get ( $ i , $ j ) + $ this -> A [ $ i ] [ $ j ] ) ; } } return $ M ; break ; case 'array' : $ M = new Matrix ( $ args [ 0 ] ) ; //$this->checkMatrixDimensions($M); for ( $ i = 0 ; $ i < $ this -> m ; $ i ++ ) { for ( $ j = 0 ; $ j < $ this -> n ; $ j ++ ) { $ M -> set ( $ i , $ j , $ M -> get ( $ i , $ j ) + $ this -> A [ $ i ] [ $ j ] ) ; } } return $ M ; break ; default : trigger_error ( PolymorphicArgumentException , ERROR ) ; break ; } } else { trigger_error ( PolymorphicArgumentException , ERROR ) ; } }
plus
A + B
@param mixed $B Matrix/Array
@return Matrix Sum
plus A + B