src/MatrixMath.php
public static function mul(Matrix $matrix, $value) : Matrix {

        if ($value instanceof Matrix) {
            return self::mulMatrix($matrix, $value);
        }

        if (is_numeric($value)) {
            return self::mulScalar($matrix, $value);
        }

        $type = gettype($value);
        throw new InvalidArgumentException("Invalid type. Can not multiply a matrix with {$type}.");
    }
public static function mul(Matrix $matrix, $value) : Matrix {

        if ($value instanceof Matrix) {
            return self::mulMatrix($matrix, $value);
        }

        if (is_numeric($value)) {
            return self::mulScalar($matrix, $value);
        }

        $type = gettype($value);
        throw new InvalidArgumentException("Invalid type. Can not multiply a matrix with {$type}.");
    }
public static function mul ( Matrix $ matrix , $ value ) : Matrix { if ( $ value instanceof Matrix ) { return self :: mulMatrix ( $ matrix , $ value ) ; } if ( is_numeric ( $ value ) ) { return self :: mulScalar ( $ matrix , $ value ) ; } $ type = gettype ( $ value ) ; throw new InvalidArgumentException ( "Invalid type. Can not multiply a matrix with {$type}." ) ; }
Matrix multiplication.

Multiplies the Matrix with either a scalar or another matrix.

Currently only supports matrix multiplication with same type of matrices.

@param Matrix $matrix
@param float|Matrix $value
@return Matrix
@throws Exception
Matrix multiplication .