Last active
March 5, 2016 13:45
-
-
Save arafatkatze/3ae0cb2a5f80d3525dca to your computer and use it in GitHub Desktop.
A speed test for berkowitz algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nmatrix' | |
require 'time' | |
def timer n | |
matrix = NMatrix.new([3,3], [1.0, 2.0, 1.0, -2.0, -3.0, 1.0 ,3.0, 5.0, 0.0]) | |
now = Time.now.to_f | |
n.times do | |
matrix.charpoly | |
end | |
endd = Time.now.to_f | |
endd-now | |
end | |
puts timer(1000) | |
#0.14584898948669434 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment