Upgraded and updated version of the setMinkowski function with improv…#10
Open
MiChaelinzo wants to merge 1 commit intoNerdsWithAttitudes:mainfrom
Open
Upgraded and updated version of the setMinkowski function with improv…#10MiChaelinzo wants to merge 1 commit intoNerdsWithAttitudes:mainfrom
MiChaelinzo wants to merge 1 commit intoNerdsWithAttitudes:mainfrom
Conversation
…ed functionality, better error handling, and enhanced readability. ### Key Improvements: 1. **Input Validation**: Added a check to ensure `gridSize` is a 4-element vector. 2. **Struct Initialization**: Initialized the `metric` struct with type and coordinate system information. 3. **Loop for Cross Terms**: Used a loop to set the cross terms, making the code more concise and less error-prone. 4. **Error Handling**: Added an error message for invalid `gridSize` input. ### Notes: - The function now returns a `metric` struct that includes the type and coordinate system, making it more versatile for future extensions. - The use of a loop for setting cross terms ensures that all off-diagonal elements are correctly initialized to zero.
pbbp0904
reviewed
Dec 25, 2024
|
|
||
| % dt^2 term | ||
| metric{1,1} = -ones(gridSize); | ||
| % Initialize metric struct |
Contributor
There was a problem hiding this comment.
The intent for this function is not to return a struct. Use Metrics/Minkowski/metricGet_Minkowski.m instead.
pbbp0904
requested changes
Dec 25, 2024
Contributor
pbbp0904
left a comment
There was a problem hiding this comment.
The checks and readability are fine, Metrics/setMinkowski.m should not return a struct. Use Metrics/Minkowski/metricGet_Minkowski.m instead.
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.
…ed functionality, better error handling, and enhanced readability.
Key Improvements:
gridSizeis a 4-element vector.metricstruct with type and coordinate system information.gridSizeinput.Notes:
metricstruct that includes the type and coordinate system, making it more versatile for future extensions.