ruby-numo / numo-linalg

Linear Algebra Library for Ruby/Numo::NArray
BSD 3-Clause "New" or "Revised" License
38 stars 9 forks source link

inv of singular matrix returns some matrix without error #43

Open gitogito opened 2 years ago

gitogito commented 2 years ago

I tried this script.

require "numo/linalg"

a = Numo::DFloat[[0, 0],
                 [0, 0]]
p(Numo::Linalg.inv(a))

Result is here.

Numo::DFloat#shape=[2,2]
[[0, 0], 
 [0, 0]]

I think that a matrix with all zero elements has no inverse matrix.