-
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
The input record separator on method IO.each is changed when nmatrix library in required #548
Comments
Honestly, I'm not sure. I don't see where it is changing |
@MohawkJohn I was hit by this and investigated a little. It looks like this is result of using |
Unfortunately, packable is pretty necessary for the MATLAB-format matrix readers and writers. If someone wanted to rewrite those, it'd be fine to shed packable. @moloh Please open an issue here: https://github.com/sciruby/packable/issues |
Close this? Doesn't seem related to nmatrix. |
@v0dro I think the idea is that we probably need to come up with a solution in NMatrix that doesn't require packable. Or perhaps that we should make Matlab IO into a plugin. |
I like the plugin idea. Its not a core functionality anyway. |
Is there a fix for this already? Can't run my neural network implementation using nmatrix's latest version due to the packable gem. :( |
No. We're all volunteers. I'd encourage you to submit whatever workaround you come up with. |
Hi all |
On ruby version ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux] when nmatrix is required, the following code:
` File.open(file).each do |line|
Generates this output:
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10
b1 1 1 1 1 1 1 1 1 1 0
b2 1 1 1 1 1 1 1 1 1 0
b3 0 0 0 0 0 0 0 0 0 0
b4 0 0 0 0 0 0 0 0 0 0
b5 0 0 0 0 0 0 0 0 0 0
b6 0 0 0 0 0 0 0 0 0 0
b7 0 0 0 0 0 0 0 0 0 0
b8 0 0 0 0 0 0 0 0 0 0
b9 0 0 0 0 0 0 0 0 0 0
b10 0 0 0 0 0 0 0 0 0 0-
["c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10\nb1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "0\nb2", "1", "1", "1", "1", "1", "1", "1", "1", "1", "0\nb3", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0\nb4", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0\nb5", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0\nb6", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0\nb7", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0\nb8", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0\nb9", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0\nb10", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]`
If I change the each line to:
File.open(file).each(sep=$/) do |line|
The each method has its normal behaviour and I get this ouput:
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10-
["c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10"]
b1 1 1 1 1 1 1 1 1 1 0-
["b1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "0"]
b2 1 1 1 1 1 1 1 1 1 0-
["b2", "1", "1", "1", "1", "1", "1", "1", "1", "1", "0"]
b3 0 0 0 0 0 0 0 0 0 0-
["b3", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
b4 0 0 0 0 0 0 0 0 0 0-
["b4", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
b5 0 0 0 0 0 0 0 0 0 0-
["b5", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
b6 0 0 0 0 0 0 0 0 0 0-
["b6", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
b7 0 0 0 0 0 0 0 0 0 0-
["b7", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
b8 0 0 0 0 0 0 0 0 0 0-
["b8", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
b9 0 0 0 0 0 0 0 0 0 0-
["b9", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
b10 0 0 0 0 0 0 0 0 0 0-
["b10", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
[[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]
Why nmatrix changes the IO.each method?
Thanks in advance
The text was updated successfully, but these errors were encountered: