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

Showing some special arrays #83

Closed
odashi opened this issue Nov 10, 2022 · 9 comments
Closed

Showing some special arrays #83

odashi opened this issue Nov 10, 2022 · 9 comments
Assignees
Labels
Milestone

Comments

@odashi
Copy link
Collaborator

odashi commented Nov 10, 2022

Ref: #78

We can also support showing some special array functions as a fixed, well-known form. For example, ndarray.zeros((2, 3)) --> $\mathbf{0}$ or $\mathbf{0}^{2 \times 3}$

@odashi odashi self-assigned this Nov 10, 2022
@Casper-Guo
Copy link
Contributor

Similar:

np.eye(N, M=None, k=0) --> $I_N$

np.identity(N) --> $I_N$

@odashi odashi added the feature label Nov 12, 2022
@Casper-Guo
Copy link
Contributor

I will do this once i figure out CI/CD on my other PR.

Once NDArray support is done, we can do the same for np.transpose() and np.inv() etc. as well

@odashi odashi added this to the v0.3 milestone Nov 16, 2022
@Casper-Guo
Copy link
Contributor

What is the best place to check for function names for this issue? Should this be done in the function_expander.py file following #132 or should it be checked in visit_Call in function_codegen.py following #118 ?

@odashi
Copy link
Collaborator Author

odashi commented Nov 28, 2022

@Casper-Guo If you are planning to implement this on FunctionExpander, function_expander_test.py is the best place I think.

@Casper-Guo
Copy link
Contributor

Casper-Guo commented Nov 29, 2022

Sorry I didn’t meant checking as in writing test cases. I was asking where best to extract numpy function names and generate the appropriate Latex. The two linked PRs seem to do this in different files

We will have a PR ready for this within the week

Cc: @LakeBlair

@LakeBlair
Copy link
Contributor

@odashi I just created a pull request for this feature. I wasn't too sure the best place to implement this feature so I added them to visit_call() in function_codegen.py. Could you review?

@odashi
Copy link
Collaborator Author

odashi commented Dec 5, 2022

@LakeBlair I checked it now. Overall it looks great, but it also requires some refactoring to support complete syntax and error handling. If you are okay, I will fix remaining things on behalf of you.

@LakeBlair
Copy link
Contributor

@odashi I added a generalization for np.zeros function, please check my most recent commit. Additionally, for your second bullet point

I think these processes don't work if the subtree has unexpected syntax. It usually happens when users gave other functions with the same name. As the AST varies, we basically need complete check of the underlying structure of the given subtree.

I‘d love to implement a complete check for the subtree structure. Do you know in which file(s) I can find a similar example for such implementation?

@odashi
Copy link
Collaborator Author

odashi commented Dec 5, 2022

Okay, let's move onto the pull request to continue the discussion.

@odashi odashi closed this as completed Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants