Skip to content

Upgraded and updated version of the setMinkowski function with improv…#10

Open
MiChaelinzo wants to merge 1 commit intoNerdsWithAttitudes:mainfrom
MiChaelinzo:patch-3
Open

Upgraded and updated version of the setMinkowski function with improv…#10
MiChaelinzo wants to merge 1 commit intoNerdsWithAttitudes:mainfrom
MiChaelinzo:patch-3

Conversation

@MiChaelinzo
Copy link
Copy Markdown

…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.

…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.
Comment thread Metrics/setMinkowski.m

% dt^2 term
metric{1,1} = -ones(gridSize);
% Initialize metric struct
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent for this function is not to return a struct. Use Metrics/Minkowski/metricGet_Minkowski.m instead.

Copy link
Copy Markdown
Contributor

@pbbp0904 pbbp0904 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checks and readability are fine, Metrics/setMinkowski.m should not return a struct. Use Metrics/Minkowski/metricGet_Minkowski.m instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants