-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat(matrix): Introduce methods for swapping specified rows and columns #108
Conversation
Introduced new methods to swap specified rows in the matrix. It utilizes the `System.arraycopy` method to perform the row swaps, which offers better performance and speed. Additionally, it allows negative indexing for specifying the first row and the second row (i.e., counting from the end of the rows).
Introduced new methods to swap specified rows in the matrix. It swaps the columns' elements directly without using a temporary variable, relying on arithmetic operations to perform the swap.
New taglets that has been added: - apiNote (ptcmf) - implNote (ptcmf) Additionally, removed the `<compilerVersion>` in the configuration of maven-compiler-plugin due to incompatible with the maven-compiler-plugin version 3.13.0.
Added more description about matrix definition in the `Matrix` class docs. And also update its version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bad logic inside the body insertRow
method on row index checker.
jmatrix/src/main/java/com/mitsuki/jmatrix/Matrix.java
Lines 958 to 963 in ebd80dd
} else if (row < 0 || row > mRows) { // Check for the index is out of bounds | |
JMatrixUtils.raiseError(new InvalidIndexException( | |
String.format("Given row index is out of range: %d", | |
(row < 0) ? (row - mRows - 1) : row | |
) | |
)); |
It should be like this:
- } else if (row < 0 || row > mRows) { // Check for the index is out of bounds
+ } else if (row < 0 || row >= mRows) { // Check for the index is out of bounds
Where the given row
must be lower than (and not equals) to mRows
(the total rows of the matrix).
This issue was moved to #110. |
Overview
This pull request introduces several enhancements and improvements to the
Matrix
class, focusing on documentation updates, refactoring, and the addition of methods for swapping specified rows and columns within the matrix.Notable Changes
Feature Addition: Two sets of methods have been introduced to facilitate the swapping of specified rows and columns within the matrix. These methods optimize performance by either directly swapping column elements relying on arithmetic operations or utilizing
System.arraycopy
for row swaps.Documentation Enhancement: Detailed descriptions have been added to clarify the matrix definition in the
Matrix
class documentation. Additionally, the class version has been updated.Refactoring: New taglets, namely
apiNote
andimplNote
, have been incorporated. Furthermore, adjustments have been made to the configuration of themaven-compiler-plugin
dependency to resolve compatibility issues with version 3.13.0.Description
Features Addition
System.arraycopy
have been introduced. This approach not only improves performance but also facilitates negative indexing for specifying rows, allowing for greater flexibility in matrix manipulation.Documentation Enhancement
Matrix
class documentation now provides a more comprehensive explanation of the matrix definition, aiding developers in better understanding its functionalities and usage.Refactoring
apiNote
andimplNote
) have been integrated into the codebase, enriching the documentation with additional context and implementation notes.maven-compiler-plugin
version 3.13.0,<compilerVersion>
has been removed from the plugin configuration, ensuring smooth integration with the latest dependency version.Summary
This pull request enhances the
Matrix
class by focusing on refactoring code for better maintainability, and introducing efficient methods for swapping specified rows and columns within the matrix. These changes aim to streamline development processes, optimize performance, and enrich the overall user experience when working with matrices in the application.