repo.or.cz
/
rbx.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Change soft-fail to use the config, rather than env
[rbx.git]
/
benchmark
/
borasky
/
hilbert.rb
blob
05210bcd3455260790638d781f850b31c06b959b
1
require 'mathn' # also brings in matrix, rational and complex
2
3
# return a Hilbert matrix of given dimension
4
def hilbert(dimension)
5
rows = Array.new
6
(1..dimension).each do |i|
7
row = Array.new
8
(1..dimension).each do |j|
9
row.push(1/(i + j - 1))
10
end
11
rows.push(row)
12
end
13
return(Matrix.rows(rows))
14
end