[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Problem with gsl

From: Abdul-Rahman Advany
Subject: [Help-gsl] Problem with gsl
Date: Wed, 30 Jan 2008 19:14:11 +0100

Hi guys,

I am working with rb-gsl but I think there is some error that is comming
from gsl as the error message is "matrix/vector sizes are not conformant"

I am trying to multiply 3 matrixes:

bob: "GSL::Matrix\n[  5.000e+00  5.000e+00  0.000e+00  0.000e+00  0.000e+00
5.000e+00 ]"
u2: "GSL::Matrix\n[ -4.472e-01 -3.586e-01 -2.925e-01 -2.078e-01 -5.099e-01 -
5.316e-01 \n   5.373e-01 -2.461e-01  4.033e-01 -6.700e-01 -5.970e-02 -
1.887e-01 ]"
eig2.inv: "GSL::Matrix\n[  5.645e-02  0.000e+00 \n   0.000e+00  1.565e-01 ]"

I am executing the code bobEmbed = bob * u2 * eig2.inv to embed bob into the
larger matrix.

Only getting the error "GSL::ERROR::EBADLEN Exception: Ruby/GSL error code
19, matrix column size and vector length are not equal (file
getset_source.c, line 146), matrix/vector sizes are not conformant"

My code is

require "gsl"

m = GSL::Matrix[

u, vt, s = m.SV_decomp
s = GSL::Matrix.diagonal(s)

u2 = GSL::Matrix[u.column(0), u.column(1)].transpose
v2 = GSL::Matrix[vt.column(0), vt.column(1)].transpose
eig2 = GSL::Matrix[s.column(0).to_a.flatten[0,2], s.column

# add bob
bob = GSL::Matrix[[5,5,0,0,0,5]]
bobEmbed = bob * u2 * eig2.inv

Could someone give my some pointers how to fix this?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]