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

Remove NArray from ruby typemap #4178

Open
karlnapf opened this issue Feb 16, 2018 · 4 comments
Open

Remove NArray from ruby typemap #4178

karlnapf opened this issue Feb 16, 2018 · 4 comments

Comments

@karlnapf
Copy link
Member

Ruby these days supports matrices natively, so no need to do this with the unmaintained narray.

This task is to re-write the typemap such that the new in-built matrices/vectors are used.

The meta example integration tests serve as a reference -- they can only pass if the typemap works correctly. The task is quite nontrivial, but there is a lot of existing code to guide the way, so still a good first issue

@FaroukY
Copy link
Contributor

FaroukY commented Mar 14, 2018

@karlnapf I am interested in this issue.

For array, we can replace NArray.xxx($arguments) for example with Array.new($arguments){xxx(0) }, is that okay?

I also had a look at Ruby's Matrix library (The one in std-lib now) and it looks like the matrix is actually immutable, so once it is initialized, it can't be assigned since the [] operator is private. (The author of Ruby said he will make it mutable in the future)

One workaround to this is to use:
A = Array.new( num_of_rows ){Array.new( num_of_columns) {0} }

Would that be okay to replace NMatrix.xxx()? And if so, I'd have to slightly edit the translate.py file so that it passes in addition $numRows, $numColumns (and $arguments) so that I can set the ruby.json as:

Array.new( $numRows ){Array.new( $numColumns ) {0} }

If that sounds good then let me know and I'll start working on it.

@karlnapf
Copy link
Member Author

karlnapf commented Mar 15, 2018

Hey.
Before you check out the meta examples, you will have to look into the typemaps.
I suggest you modify one of the generated meta example code listings by hand and then execute them by hand to see how you will have to modify the grammar. But the meta examples are not the problem here, it is easy to update that once the typemaps use the native ruby matrix lib.
Check swig_typemaps.i in interfaces/ruby
If the matrix class is immutable, then we will need to discuss this a bit ...

@songxujing
Copy link

@FaroukY
Hello, I'm a shogun beginner and I want to use this tool to do multiple kernel learning. But when I use SVMLight, I get an error. Later I learned that I needed to compile manually, but I encountered a lot of errors in the compilation process. I hope you can help me and write a detailed compilation step for me. I am ubuntu16.04+python2.7+shogun

@karlnapf
Copy link
Member Author

@songxujing pls dont spam this thread which is about something else. Pls use the mailing list or open a new issue.

@vigsterkr vigsterkr added this to TODO in Shogun Ruby Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Shogun Ruby
  
TODO
Development

No branches or pull requests

3 participants