[ruby/matrix] Fix 0-th power [Bug #17521] (#4047)

This commit is contained in:
Marc-André Lafortune 2021-01-10 16:21:10 -05:00 committed by GitHub
parent 8187228de0
commit d8c8b79d24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2021-01-11 06:21:37 +09:00
Merged-By: marcandre <github@marc-andre.ca>
2 changed files with 17 additions and 4 deletions

View file

@ -1239,7 +1239,7 @@ class Matrix
when Integer
case
when exp == 0
_make_sure_it_is_invertible = inverse
raise ErrDimensionMismatch unless square?
self.class.identity(column_count)
when exp < 0
inverse.power_int(-exp)