/usr/share/doc/ruby-gsl/examples/linalg/LU.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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #!/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
m.print
lu.print
b = Vector[1, 2, 3, 4]
x = LU.solve(lu, perm, b)
x = LU.solve(lu, perm, b)
p x
p m
p m.LU_solve(b)
p m.LU_solve(perm, b)
p m.LU_solve(perm, b, x)
p lu.LU_solve(perm, b, x)
p x
LU.refine(m, lu, perm, b, x)
p x
#p b
#m.LU_svx(b)
#p b
#LU.svx(lu, perm, b)
#p b
#p m.LU_solve(perm, b)
#p m.LU_solve(perm, b, x)
#p lu.LU_solve(perm, b, x)
#exit
LU.svx(lu, perm, b)
p b
p m*x.col
b = [1, 2, 3, 4].to_gv
p LU.solve(m, b)
puts("")
m2 = Matrix.alloc([1, 2, 3, 6, 5, 4, 7, 8, 1], 3, 3)
m2.print
lu2, p2, sign = m2.LU_decomp
m3 = Matrix.alloc([1, 2, 3, 4, 5, 6, 7, 8, 0], 3, 3)
m3.print
lu, perm = m3.LU_decomp
LU.invert(lu, perm).print
p m3.class
p lu.class
m4 = m3.invert
LU.invert(m3).print
p m4.invert
p m3.invert.invert.invert
p m2.det
p lu2.det(p2, sign)
p m2.det(p2)
p LU.det(m2)
p LU.lndet(m2)
p LU.lndet(lu2)
p m2.lndet
p lu2.lndet
p LU.sgndet(m2)
p LU.sgndet(lu2, sign)
p m2.sgndet
p lu2.sgndet(sign)
p m
p m/b.col
__END__
|