public function subtract($b)
    {
        switch (true) {
            case $b instanceof Matrix:
                $c = $this->subtractMatrix($b);
                break;

            case $b instanceof ColumnVector:
                $c = $this->subtractColumnVector($b);
                break;
                
            case $b instanceof Vector:
                $c = $this->subtractVector($b);
                break;

            case is_int($b) or is_float($b):
                $c = $this->subtractScalar($b);
                break;

            default:
                throw new InvalidArgumentException('Cannot subtract a '
                    . gettype($b) . ' from a matrix.');
        }

        return $c;
    }
public function subtract($b)
    {
        switch (true) {
            case $b instanceof Matrix:
                $c = $this->subtractMatrix($b);
                break;

            case $b instanceof ColumnVector:
                $c = $this->subtractColumnVector($b);
                break;
                
            case $b instanceof Vector:
                $c = $this->subtractVector($b);
                break;

            case is_int($b) or is_float($b):
                $c = $this->subtractScalar($b);
                break;

            default:
                throw new InvalidArgumentException('Cannot subtract a '
                    . gettype($b) . ' from a matrix.');
        }

        return $c;
    }
public function subtract ( $ b ) { switch ( true ) { case $ b instanceof Matrix : $ c = $ this -> subtractMatrix ( $ b ) ; break ; case $ b instanceof ColumnVector : $ c = $ this -> subtractColumnVector ( $ b ) ; break ; case $ b instanceof Vector : $ c = $ this -> subtractVector ( $ b ) ; break ; case is_int ( $ b ) or is_float ( $ b ) : $ c = $ this -> subtractScalar ( $ b ) ; break ; default : throw new InvalidArgumentException ( 'Cannot subtract a ' . gettype ( $ b ) . ' from a matrix.' ) ; } return $ c ; }
A universal function to subtract this matrix from another tensor
element-wise.

@param mixed $b
@throws \InvalidArgumentException
@return mixed
A universal function to subtract this matrix from another tensor element - wise .