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

Meta language: Modified parser to handle SGVector, SGMatrix accessing #3285

Merged
merged 1 commit into from
Jun 19, 2016

Conversation

sorig
Copy link
Member

@sorig sorig commented Jun 13, 2016

WIP

@@ -1,3 +0,0 @@
generator/parsetab.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@karlnapf
Copy link
Member

Cool thanks for that. Once we have a json update, I can take over

@sorig sorig force-pushed the meta_sg_access branch 3 times, most recently from 8e87352 to 9764e7c Compare June 16, 2016 15:38
@sorig
Copy link
Member Author

sorig commented Jun 16, 2016

@karlnapf ready for review when travis has finished

These changes include:

  • Support for element access and element assignment for SGVectors and SGMatrices
  • Refactor of translate.py: dependency extraction and automatic injection of variable storing is now mostly decoupled from translation. This should make maintenance easier in the future.
  • Support for native construction of SGMatrix/SGVector equivalents in target languages. This is implemented for Python. It is an optional feature so doesn't break the other languages.

Does not include:

  • Checking that variables being accessed (e.g. myMatrix[0,2]) are actually of type SGVector/SGMatrix

@sorig
Copy link
Member Author

sorig commented Jun 16, 2016

Here is a test file that I used. Would be nice to get a meta example using these features merged, so we can test all the languages.

"CharVector": "$name = np.zeros( ($arguments), dtype='|S1')",
"ByteVector": "$name = np.zeros( ($arguments), dtype='uint8')",
"WordVector": "$name = np.zeros( ($arguments), dtype='uint16')",
"ShortVector": "$name = np.zeros( ($arguments), dtype=???????)",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't import some of these from the Python interface, so can't check what type they should have. Maybe they just need to be removed?

@sorig sorig force-pushed the meta_sg_access branch 3 times, most recently from 2f0d406 to fe0edfc Compare June 17, 2016 16:16
- Modify meta language to handle SGVector, SGMatrix accessing.
- Fix line number counting bug
- Improve error messages from translation errors
- Translate.py: Decouple dependency extraction and translation
- Translate.py: Decouple injection of variable storing code and translation
- Fix most PEP8 violations
- Add support for custom initialisation of SGVector/Matrix in target languages
  e.g. (python) initialisation of numpy arrays rather than SWIG wrappers
- Remove legacy file get_type_list.sh
@karlnapf
Copy link
Member

Let me know when the vector / matrix access stuff is there.
In the test file, it would be good to check both accessing matrix and vector

@sorig
Copy link
Member Author

sorig commented Jun 17, 2016

@karlnapf All green. Ready to merge

@sorig
Copy link
Member Author

sorig commented Jun 17, 2016

The test file has both a vector and a matrix :)

@karlnapf karlnapf merged commit 63242e5 into shogun-toolbox:develop Jun 19, 2016
@karlnapf
Copy link
Member

Great thanks

@OXPHOS this will soon allow for vector element access in meta examples, after I added some minor adjustments

@karlnapf
Copy link
Member

@OXPHOS you should be able to use something like this now

Can you try?

@karlnapf
Copy link
Member

keep in mind to remove old parser output

karasikov pushed a commit to karasikov/shogun that referenced this pull request Apr 15, 2017
Meta language: Modified parser to handle SGVector, SGMatrix accessing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants