mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Also replace E2MM to standard exception class
This commit is contained in:
parent
0950ef9a9a
commit
0c59bfae0a
Notes:
git
2019-11-30 08:01:06 +09:00
1 changed files with 4 additions and 4 deletions
|
@ -78,7 +78,7 @@ class Matrix
|
||||||
|
|
||||||
def det
|
def det
|
||||||
if (@row_count != @column_count)
|
if (@row_count != @column_count)
|
||||||
Matrix.Raise Matrix::ErrDimensionMismatch
|
raise Matrix::ErrDimensionMismatch
|
||||||
end
|
end
|
||||||
d = @pivot_sign
|
d = @pivot_sign
|
||||||
@column_count.times do |j|
|
@column_count.times do |j|
|
||||||
|
@ -94,11 +94,11 @@ class Matrix
|
||||||
|
|
||||||
def solve b
|
def solve b
|
||||||
if (singular?)
|
if (singular?)
|
||||||
Matrix.Raise Matrix::ErrNotRegular, "Matrix is singular."
|
raise Matrix::ErrNotRegular, "Matrix is singular."
|
||||||
end
|
end
|
||||||
if b.is_a? Matrix
|
if b.is_a? Matrix
|
||||||
if (b.row_count != @row_count)
|
if (b.row_count != @row_count)
|
||||||
Matrix.Raise Matrix::ErrDimensionMismatch
|
raise Matrix::ErrDimensionMismatch
|
||||||
end
|
end
|
||||||
|
|
||||||
# Copy right hand side with pivoting
|
# Copy right hand side with pivoting
|
||||||
|
@ -128,7 +128,7 @@ class Matrix
|
||||||
else # same algorithm, specialized for simpler case of a vector
|
else # same algorithm, specialized for simpler case of a vector
|
||||||
b = convert_to_array(b)
|
b = convert_to_array(b)
|
||||||
if (b.size != @row_count)
|
if (b.size != @row_count)
|
||||||
Matrix.Raise Matrix::ErrDimensionMismatch
|
raise Matrix::ErrDimensionMismatch
|
||||||
end
|
end
|
||||||
|
|
||||||
# Copy right hand side with pivoting
|
# Copy right hand side with pivoting
|
||||||
|
|
Loading…
Add table
Reference in a new issue