Sha256: b04a5bbfc6a48660b50f76ccf2796d50470c27a2e848099614c3f4375c334bef

Contents?: true

Size: 454 Bytes

Versions: 6

Compression:

Stored size: 454 Bytes

Contents

#!/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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
gsl-2.1.0.3 examples/linalg/LU2.rb
gsl-2.1.0.2 examples/linalg/LU2.rb
gsl-2.1.0.1 examples/linalg/LU2.rb
gsl-2.1.0 examples/linalg/LU2.rb
gsl-1.16.0.6 examples/linalg/LU2.rb
rb-gsl-1.16.0.5 examples/linalg/LU2.rb