/usr/share/doc/ruby-gsl/examples/linalg/LU2.rb is in ruby-gsl 2.1.0.3+dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #!/usr/bin/env ruby
require("gsl")
include GSL
include Linalg
m = Matrix::alloc([0.18, 0.60, 0.57, 0.96], [0.41, 0.24, 0.99, 0.58],
[0.14, 0.30, 0.97, 0.66], [0.51, 0.13, 0.19, 0.85])
m.print
lu, perm = m.LU_decomp
b = [1, 2, 3, 4]
x = Vector.alloc(4)
p m.class
p LU.solve(lu, perm, b)
LU.solve(lu, perm, b, x)
p x
p LU.solve(m, b)
LU.solve(m, b, x)
p x
LU.solve(m, perm, b, x)
p x
bv = b.to_gv
LU.svx(m, perm, bv)
p bv
m.print
|