numo-narray
numo-narray copied to clipboard
Matrix inversion
Hello, Does this library support matrix inversion? The old version of NArray does but I can't find it here. I searched the Doc and 100 narray exercises but sadly I didn't find anything. Can I maybe find it under a different name?
Thanks
I think one way is to use Numo::Linalg.
require 'numo/linalg'
# require 'numo/linalg/autoloader'
a = Numo::DFloat[[1, 2], [3, 4]]
ainv = Numo::Linalg.inv(a)
p a.dot(ainv)
p Numo::Linalg.dot(a, ainv)
a = Numo::DFloat.cast([[[1, 2], [3, 4]], [[1, 3], [3, 5]]])
p Numo::Linalg.inv(a)
Same result as numpy.linalg.inv.
@masa16
Is there any way to perform inv
without using Numo::Linalg?
Good to know, I was thinking about using Numo::Linalg library anyways.
I modified basic dot
method for my own use, so now it multiplies matrices in Galois/Finite fields but realized too late that library doesn't include inv
method.
Thanks for help, of course if there is a way to do it without using Numo::Linalg I would also appreciate the answer. Take care.