-
Notifications
You must be signed in to change notification settings - Fork 22
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
Incorrect code gen for subdimension set by GET DIRECT CONSTANTS #124
Comments
This turned out to be two separate problems. The The dimensions are picked from the LHS in model order. They will map to the CSV data table in model order. Then the complete set of LHS subscripts that will map to the table are generated as a list of index subscript tuples. These will end up on the LHS of C assignment statements, so they are in normal order to match C array declarations. When one of the subscripts to be mapped to the data table is a subdimension, the variable will already be separated by the time we get to To get the data table cell offset from the start cell, we start by finding the position of the LHS index in model order by comparing with the subscript families of LHS model order subscripts. To support subdimensions, we need to use the position of the index within the subdimension instead of the index value. That's because the data table has rows or columns maching the subdimension index position, not the subdimension index value. For instance, in the equation for Finally, we add a constant variable for each cell in the table, using numeric LHS indices into the C array, and the corresponding cell offset into the table. Whew! The second problem was solved by improving the way we match against EXCEPT subscripts. Previously, we simply tested whether the LHS subscripts were equal to the EXCEPT subscripts. When the EXCEPT subscripts involve a subdimension, we need to examine each subscript separately, and test whether an index on the LHS belongs to a subdimension in the EXCEPT subscripts. |
…EXCEPT handling (#125) Fixes #124 Fixes #134 Co-authored-by: Chris Campbell <[email protected]>
Code generation is incorrect when an array is initialized by a combination of literal constants and values read from a file by
GET DIRECT CONSTANTS
. Two equations set the constant values. GET DIRECT CONSTANTS initializes elements given by a subdimension, with the remaining elements carved out by an EXCEPT clause.The first value from the CSV file is repeated for all elements in the subdimension:
The literal const goes to all elements of the subscript family, not just the elements remaining after the EXCEPT:
The text was updated successfully, but these errors were encountered: