-
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
Print functions for NMatrix #535
Comments
You're certainly welcome to submit a patch. You can also rephrase this as a feature request and it's possible someone else will get to it eventually. |
Can we agree first on how to modify the outputs ?
|
Hi @MohawkJohn and @cedlemo else # dim 2
q.group(0, "\n[\n ", "]") do #add a blank space
self.each_row.with_index do |row,i|
q.group(1, " [", "]\n") do #add a line break
q.seplist(self.dim > 2 ? row.to_a[0] : row.to_a, lambda { q.text ", " }, :each_with_index) { |v,j| q.text v.inspect.rjust(longest[j]) }
end
q.breakable
end
end
end solves the issue. |
The solution of @prasunanand solve the bad ouput when we pretty_print a 2D matrix. it remains 2 problems that I described previously:
@prasunanand could create a PR for his solution. I am OK to work on the two remaining problems but I prefer that we agree before on what it is expected. I don't want to take on my free time to do stuff that won't be accepted/merged because we didn't agree on what you want before. Regards Edit |
I do not think I'm fine with @prasunanand's change. I believe we're still waiting to hear back from @Aelphy. My guess is they're no longer interested, in which case #500 is dead. |
Okay, #500 just got revived. I merged it. Please re-open if this issue is not resolved by that PR. |
I am trying to write the part https://github.com/SciRuby/nmatrix/wiki/Tentative-NMatrix-Tutorial#printing-arrays in the wiki and I am rather disapointed. here is my irb session:
I found that the
puts
output is useless (from my POV), thepp
output is ugly( at least for 2 D matrix). Furthermore on big arrays, it shows all the elements unlike numpy which shows just a part of the array. This is the same under pry and maybe worst because when you create a big matrice, pry usepp
directly :Sorry if it sound harsh, maybe it is linked to my lack of knowledge NMatrix.
Regards.
The text was updated successfully, but these errors were encountered: