lib/csrmatrix/decompositions.rb in csrmatrix-1.0.0 vs lib/csrmatrix/decompositions.rb in csrmatrix-1.0.1

- old
+ new

@@ -1,22 +1,24 @@ module CsrMatrix - module Decompositions + module Decompositions + include Contracts::Core + C = Contracts - def eigen() - eigensystem() - end - - def eigensystem() - m = Matrix.rows(self.decompose) - return m.eigensystem().to_a[0].to_a - end - - def lup() - puts "lup" - end - - def lup_decomposition() - - end - - end -end \ No newline at end of file + Contract C::None => C::ArrayOf[C::ArrayOf[C::Num]] + def eigen() + # alias for eigensystem + # returns a list in the form {eigenvalues, eigenvectors} + is_invariant? + + self.eigenvalue() + end # eigen + + Contract C::None => C::ArrayOf[C::ArrayOf[C::Num]] + def eigenvalue() + # identifies the eigenvalues of a matrix + is_invariant? + # post eigenvalues of the matrix + m = Matrix.rows(self.decompose) + return m.eigensystem().to_a[1].round().to_a + end # eigenvalue + end # Decompositions +end # CsrMatrix