-
Notifications
You must be signed in to change notification settings - Fork 133
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
Segmentation faults when using sparse matrices #35
Comments
It will be fixed but I suspect that you have some misconceptions about a list matrix.
Thanks for report, if @MohawkJohn will not be against I can fix up this bug. |
For (2) most of the values I'm setting are 0. I'm using a sparse matrix as a vector space model. For (1), I don't understand, "your code (if it works) does nothing". For example, this works fine: matrix = NMatrix.new(:list, [2, 2], :float64)
matrix.pretty_print Prints:
Then: matrix[0, 0] = 1
matrix.pretty_print Gives:
My code is doing the same thing as above, except inside loops. |
(1) Sorry. I have understood what you fill a matrix by zero values. And from (2) I agree that your choice of type matrix is right. Well.. we will fix it as soon as it possible. Thank you very mach for report again. |
Forgot to mention: this is with 0.0.1 release. I will test with HEAD as soon as I can install it. |
It's very important because 0.0.2 is very differ from 0.0.1 inwardly. Actually 0.0.2 is result of deep refactoring and a big part had been rewritten in C++. I will check up it for 0.0.2. |
For 0.0.2 this code works right: m = NMatrix.new(:list, [3, 3], :float64)
[1.0,2.0,3.0].each_with_index do |x,i|
[1.0,2.0,3.0].each_with_index do |y,j|
m[i, j] = x+y
end
end
m.pretty_print Pleas try it again when you will have installed 0.0.2 version. |
Is this working for you now, @jpmckinney? Thanks, Aleksey, for working on this. |
My code works with |
When I try to fill a sparse matrix with floats, I get segmentation faults. I printed out the
i
andj
variables to see if it was trying to write outside the dimensions of the matrix, but it's not the case. I print out the value that I was trying to assign to the matrix cell, but it is0.0
, so not outside the float range.My code looks like:
With
:list
I get:With
:yale
I get:The text was updated successfully, but these errors were encountered: