Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign Ruby Complex types to GSL::Matrix::Complex #27

Open
v0dro opened this issue Jan 12, 2016 · 1 comment
Open

Assign Ruby Complex types to GSL::Matrix::Complex #27

v0dro opened this issue Jan 12, 2016 · 1 comment

Comments

@v0dro
Copy link
Member

v0dro commented Jan 12, 2016

Currently numbers of the Ruby Complex type cannot be assigned to a matrix of type GSL::Matrix::Complex, it must have GSL::Complex types:

q = GSL::Matrix::Complex.alloc(2,2)
# => #<GSL::Matrix::Complex[2,2]:0x7da6cc0>
# [ [ 0.000e+00 0.000e+00 ] [ 0.000e+00 0.000e+00 ]
# [ 0.000e+00 0.000e+00 ] [ 0.000e+00 0.000e+00 ] ]

q[0,0] = Complex(2,3)
# TypeError: wrong type Complex, (nil, Array, Float, Integer, or GSL::Complex expected)

q[0,0] = GSL::Complex.alloc(2,3)
#=> #<GSL::Matrix::Complex[2,2]:0x7d9b488>
#[ [ 2.000e+00 3.000e+00 ] [ 0.000e+00 0.000e+00 ]
# [ 0.000e+00 0.000e+00 ] [ 0.000e+00 0.000e+00 ] ]

Making this work with Ruby Complex types would be great.

@envp
Copy link
Member

envp commented Jun 9, 2016

I've added PR #38 for this, @v0dro can you please review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants