-
Notifications
You must be signed in to change notification settings - Fork 393
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
NDArray support #78
Comments
For 2D arrays, limiting the maximum size to |
I think it's a great idea to constraint the maximum size of matrices. I won't use matrix larger than 10 * 10 in Latex. |
@Casper-Guo Yes I think it is reasonable. maybe we restrict to show only |
What should the configuration interface look like? I feel this should be file level rather than function level. cc: @LakeBlair |
@Casper-Guo We can start with hard-coding the constraint into the code until we decided the structure of config files. |
I was able to implement a basic version of this within if func_str == "ndarray":
# construct matrix
matrix_str = r"\begin{bmatrix} "
# iterate over rows
for row in node.args[0].elts:
for col in row.elts:
matrix_str += self.visit(col) + r" & "
matrix_str = matrix_str[:-2] + r" \\ "
matrix_str = matrix_str[:-3] + r"\end{bmatrix}"
return matrix_str However, this isn't very extendable especially if we want to support functions like We can also potentially support multiple types of matrix formatting (square brackets vs round brackets vs curly brackets) via a config option? |
If anything, the matrix processing should probably be a separate function instead of resting in, say a |
Sometimes users want to support NDArrays in this library, e.g.,
np.array([[a, b], [c, d]])
toThis is definitely useful, but often it is not possible to compile:
I think we could start implementing it with reasonable restrictions (e.g., only NDArrays with <= 2 dimensions with small lengths), but it would be also good to keep discussion.
Refs:
The text was updated successfully, but these errors were encountered: