/usr/share/doc/ruby-gsl/examples/linalg/SV.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 | #!/usr/bin/env ruby
require("gsl")
A = GSL::Matrix[[3, 5, 2], [6, 2, 1], [4, 7, 3]]
p A
u, v, s = A.SV_decomp
p u.class
p v.class
p s.class
# u and v are orthonormal
p u*u.trans
p v*v.trans
# Reconstruct the matrix A from u, v, and s.
p u*GSL::Matrix.diagonal(s)*v.trans
|