[WIP] Add 2D sym functions and use them.#1235
Open
alexvong243f wants to merge 43 commits intognu-octave:Array_not_Matrixfrom
Open
[WIP] Add 2D sym functions and use them.#1235alexvong243f wants to merge 43 commits intognu-octave:Array_not_Matrixfrom
alexvong243f wants to merge 43 commits intognu-octave:Array_not_Matrixfrom
Conversation
It has mostly the same semantics as Matrix but can contain more general things. There might be some issues about different shapes of empties though... WIP on a fix for gnu-octave#1052.
Fixes gnu-octave#1211. * inst/private/python_header.py: Add it. * inst/private/python_ipc_native.m: Add it.
See gnu-octave#1194 for more information. * inst/@sym/private/mat_rclist_access.m: Test it.
See gnu-octave#1194 for more information. * inst/@sym/private/mat_rclist_asgn.m: Test it.
* inst/@sym/{horzcat,vertcat}.m: Fix them.
* inst/@sym/vertcat.m: Implement it.
This is a prerequisite for making @sym/horzcat Array-compatible. Partially fixes <gnu-octave#1215>. * inst/@sym/transpose.m: Implement it.
* inst/@sym/horzcat.m: Simplify it.
* inst/@sym/private/mat_rclist_{access,asgn}.m: Remove them.
The function is now compatible with non-Matrix 2D sym (e.g. Array, TableForm). Also, it now outputs empty matrices in the same way as upstream Octave (fixes gnu-octave#1218). * inst/@sym/repmat.m: Re-implement it and add tests accordingly.
Array linear indexing is not the same as Matrix linear indexing. Fixes gnu-octave#1222.
This routine is supposed to return a logical Octave array. Do linear indexing on the flattened tolist output which will work on both Array and Matrix. Fixes gnu-octave#1221.
In fact it is failing elsewhere but the point of *this* test is to change the orientation of a vector.
...with 'inst/private/python_header.py'. Follow-up to 56bd719. * inst/private/python_ipc_native.m: Disable it.
uniop_bool_helper and friends: Array support
Fixes Issue gnu-octave#1226. Related to Issue gnu-octave#1222.
This was broken with syntax errors since 2016... Apply fix for Array but leave a comment that this is unused and untested. It is referred to in isprime but commented out.
Follow-up to d3b1547. * inst/@sym/vertcat.m: Use it.
* inst/@sym/private/mat_rclist_asgn.m: Use it.
Follow-up to 136184d. * inst/@sym/transpose.m: Use it.
* inst/private/{python_header.py,python_ipc_native.m}: Generalise
function 'make_matrix_or_array', use sympy function 'flatten' in
'make_matrix_or_array'.
Instead of doing it ourselves, prepare a list of lists and call the centralized helper function.
More Array fixes
elementwise_op: call make_array_or_matrix
Collaborator
|
I force-pushed this onto top of the latest Array_not_Matrix |
added 2 commits
September 12, 2022 22:13
Generalises 'make_matrix_or_array' so that we can choose to represent
non-Matrix 2D sym to be something other than an Array in the
future. For example, we could use TableForm.
* inst/private/{python_header.py,python_ipc_native.m}: Rename function
'make_matrix_or_array' -> 'make_2d_sym', variable 'dbg_no_array' ->
'dbg_matrix_only' and adjust accordingly.
* inst/@sym/private/mat_rclist_{access,asgn}.m: Adjust accordingly.
* inst/@sym/vertcat.m: Adjust accordingly.
Add more 2D sym functions to abstract over the idea of 2D sym so that
we can choose to represent non-Matrix 2D sym to be something other
than an Array in the future. For example, we could use TableForm.
WIP: This is incomplete. More functions need to use these 2D sym
functions. Not sure if this is needed anymore as TableForm was shown
to be lacking various features such as indexing and taking
transpose. No other candidates are being considered at the moment.
* inst/private/{python_header.py,python_ipc_native.m}: Add new 2D sym
functions 'is_2d_sym', 'is_matrix', 'is_non_matrix_2d_sym',
'list_from_2d_sym' and 'shape_of_2d_sym'.
* inst/@sym/private/mat_rclist_{access,asgn}.m: Use them.
* inst/@sym/{transpose.m,vertcat.m}: Use them.
Collaborator
|
I cherry-picked a one of the commits out of here into #1194. |
4f6b65b to
47834bd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We add 2D sym functions to abstract over the idea of 2D sym so that we
can choose to represent non-
Matrix2D sym to be something other thanan
Arrayin the future. For example, we could useTableForm.This is incomplete. More functions need to use these 2D sym
functions. Not sure if this is needed anymore as
TableFormwas shownto be lacking various features such as indexing and taking
transpose. No other candidates are being considered at the moment.
This PR is introduced to avoid these changes to be forgotten. We can
close it later if this is definitely not needed or it bit rots.