Feature: Implement RESHAPE() in TDI#3012
Open
WhoBrokeTheBuild wants to merge 1 commit intoMDSplus:alphafrom
Open
Feature: Implement RESHAPE() in TDI#3012WhoBrokeTheBuild wants to merge 1 commit intoMDSplus:alphafrom
WhoBrokeTheBuild wants to merge 1 commit intoMDSplus:alphafrom
Conversation
e1e0f08 to
f32a353
Compare
Contributor
joshStillerman
left a comment
There was a problem hiding this comment.
it points at the same memory - good
Do you check if it is the right size for the dimensions ?
|
|
||
| new_array.aflags.coeff = 1; | ||
| new_array.dimct = dimct; | ||
| new_array.a0 = new_array.pointer; |
Contributor
There was a problem hiding this comment.
it points at the same memory - good
Do you check if it is the right size for the dimensions ?
Member
Author
There was a problem hiding this comment.
Yep! That's done up on line 77, I compare the original count to the product of the shape, which should be the new size
joshStillerman
approved these changes
Jan 14, 2026
f32a353 to
4f8a763
Compare
This builtin was never implemented, but the opcode was allocated and it existed in the original documentation. The similarity to numpy's reshape function means users might actually want to use this, and throwing a terse error is less than helpful. This implements RESHAPE() with only the first two arguments of SOURCE and SHAPE. The optional arguments of PAD and ORDER described in the original documetnation are not implemented, and won't be included in the new documentation for this function. ``` TDI> reshape(1:6, [2, 3]) [[1,2], [3,4], [5,6]] TDI> reshape(1:6, [3, 2]) [[1,2,3], [4,5,6]] TDI> reshape(1:8, [2, 2, 2]) [[[1,2], [3,4]], [[5,6], [7,8]]] TDI> reshape(reshape(1:8, [2, 4]), [8]) [1,2,3,4,5,6,7,8] TDI> reshape([[1,2], [3,4]], [1, 4]) [[1], [2], [3], [4]] ```
4f8a763 to
9bf426b
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.
This builtin was never implemented, but the opcode was allocated and it existed in the original documentation. The similarity to numpy's reshape function means users might actually want to use this, and throwing a terse error is less than helpful.
This implements RESHAPE() with only the first two arguments of SOURCE and SHAPE. The optional arguments of PAD and ORDER described in the original documetnation are not implemented, and won't be included in the new documentation for this function.