public function clip(float $min, float $max) : self
    {
        if ($min > $max) {
            throw new InvalidArgumentException('Minimum cannot be'
                . ' greater than maximum.');
        }

        $b = [];

        foreach ($this->a as $row) {
            $temp = [];

            foreach ($row as $value) {
                if ($value > $max) {
                    $temp[] = $max;

                    continue 1;
                }

                if ($value < $min) {
                    $temp[] = $min;

                    continue 1;
                }

                $temp[] = $value;
            }

            $b[] = $temp;
        }

        return self::quick($b);
    }
public function clip(float $min, float $max) : self
    {
        if ($min > $max) {
            throw new InvalidArgumentException('Minimum cannot be'
                . ' greater than maximum.');
        }

        $b = [];

        foreach ($this->a as $row) {
            $temp = [];

            foreach ($row as $value) {
                if ($value > $max) {
                    $temp[] = $max;

                    continue 1;
                }

                if ($value < $min) {
                    $temp[] = $min;

                    continue 1;
                }

                $temp[] = $value;
            }

            $b[] = $temp;
        }

        return self::quick($b);
    }
public function clip ( float $ min , float $ max ) : self { if ( $ min > $ max ) { throw new InvalidArgumentException ( 'Minimum cannot be' . ' greater than maximum.' ) ; } $ b = [ ] ; foreach ( $ this -> a as $ row ) { $ temp = [ ] ; foreach ( $ row as $ value ) { if ( $ value > $ max ) { $ temp [ ] = $ max ; continue 1 ; } if ( $ value < $ min ) { $ temp [ ] = $ min ; continue 1 ; } $ temp [ ] = $ value ; } $ b [ ] = $ temp ; } return self :: quick ( $ b ) ; }
Clip the elements in the matrix to be between given minimum and maximum
and return a new matrix.

@param float $min
@param float $max
@throws \InvalidArgumentException
@return self
Clip the elements in the matrix to be between given minimum and maximum and return a new matrix .