Skip to content
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: Implement Matrix , its Methods and Some Functions including Strassen Matrix Multiplication in Go #662

Merged
merged 20 commits into from
Oct 26, 2023

Commits on Sep 30, 2023

  1. feat: Implement Strassen Matrix Multiplication

    - Added the Strassen matrix multiplication algorithm for efficient matrix multiplication.
    - Added strassenmatrixmultiply.go to include the new algorithm.
    - Added example usage and test functions for verification.
    - Introduced benchmarks for performance evaluation.
    
    Closes TheAlgorithms#661 (if applicable)
    mohit07raghav19 committed Sep 30, 2023
    Configuration menu
    Copy the full SHA
    6a9aa2c View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2023

  1. This commit introduces the Strassen matrix multiplication algorithm

    along with the following supporting functions and test cases:
    
    1. `AddMatrices`: Function to add two matrices.
    2. `SubtractMatrices`: Function to subtract two matrices.
    3. `MultiplyMatrices`: Function to multiply two matrices simply using loops.
    4. `PrintMatrix`: Function to print a matrix for debugging purposes.
    5. `EqualMatrix`: Function to check if two matrices are equal.
    6. `StrassenMatrixMultiply` : Function to multiply two matrices using strassen algorithm
    mohit07raghav19 committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    b6fa85e View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2023

  1. refactor: Rename functions and add implement new functionality

    Renamed files and functions:
    - addmatrices.go to add.go
    - addmatrices_test.go to add_test.go
    - matrixmultiply.go to multiply.go
    - matrixmultiply_test.go to multiply_test.go
    - subtractmatrices.go to subtract.go
    - subtractmatrices_test.go to subtract_test.go
    - printmatrix.go to print.go
    - printmatrix_test.go to print_test.go
    
    New files:
    - breadth.go
    - breadth_test.go
    - checkequal.go
    - checkequal_test.go
    - isvalid.go
    - isvalid_test.go
    - length.go
    - length_test.go
    - samedimensions.go
    - samedimensions_test.go
    
    Modified files:
    - strassenmatrixmultiply.go
    - strassenmatrixmultiply_test.go
    
    This commit includes renaming and restructuring files for clarity, adding new functionality, and removing some obsolete files.
    mohit07raghav19 committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    bcc7475 View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2023

  1. Implement Matrix as a struct type

    This commit introduces a new  type, represented as a struct with methods for creating, manipulating, and performing operations on matrices. The following changes have been made:
    
    - Added the `Matrix` struct with fields for elements, rows, and columns.
    - Implemented the `New` function to create a new matrix with specified dimensions and initial values.
    - Implemented the `NewFromElements` function to create a matrix from a provided 2D slice of elements.
    - Added the `Get` and `Set` methods to access and modify matrix elements by row and column indices.
    - Implemented the `Print` method to print the matrix to the console.
    - Introduced the `SameDimensions` method to check if two matrices have the same dimensions.
    - Implemented functions for matrix operations, including `Add`, `Subtract`, `Multiply`, and `CheckEqual`.
    - Added a helper function `IsValid` to check if a given matrix has consistent row lengths.
    
    These changes provide a foundation for working with matrices in Go, allowing for easy creation, manipulation, and comparison of matrices.
    mohit07raghav19 committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    400e75a View commit details
    Browse the repository at this point in the history
  2. Implement StrassenMatrixMultiply and Matrix Methods

    In this commit, the following key additions have been made to the  folder:
    
    - Implemented `StrassenMatrixMultiply`, a fast matrix multiplication algorithm, to efficiently multiply two matrices.
    
    - Introduced  `Copy` method to create a deep copy of a matrix, allowing for independent manipulation without affecting the original matrix.
    
    - Implemented `Submatrix` method to extract a submatrix from an existing matrix based on specified row and column indices.
    
    - Added `Rows` and `Columns` methods to retrieve rows and columns of matrix.
    
    - Included comprehensive test cases to ensure the correctness and robustness of these newly implemented features.
    
    These enhancements expand the capabilities of the  type, making it more versatile and efficient in performing matrix operations.
    mohit07raghav19 committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    b1e4e01 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2023

  1. Refactor to Use Value Type Matrix and Add Benchmarks

    In this commit, the following significant changes have been made:
    
    1. Refactored the `Matrix` type from a pointer to a value type. Using a pointer for a small structure like `Matrix` was deemed unnecessary and has been updated to enhance code simplicity.
    
    2. Added comprehensive benchmarks to all functions. These benchmarks will help ensure that the code performs efficiently and allows for easy performance profiling.
    
    3. Fixed code integration errors that were identified during the refactoring process.
    mohit07raghav19 committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    24fe1a6 View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2023

  1. Configuration menu
    Copy the full SHA
    7923f0b View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2023

  1. Configuration menu
    Copy the full SHA
    f810d01 View commit details
    Browse the repository at this point in the history
  2. refactor: Change type variable T to constraints.Integer, rename SameD…

    …imensions to MatchDimensions, and remove unnecessary code
    
    This commit updates the type variable T to constraints.Integer, providing a more specific type constraint. It also renames the SameDimensions function to MatchDimensions for clarity. Additionally, unnecessary code lines have been removed for cleaner and more optimized code.
    mohit07raghav19 committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    3fab688 View commit details
    Browse the repository at this point in the history
  3. refractor: Implement goroutines in Add, CheckEqual, Copy, New, Multip…

    …ly, SubMatrix, and Subtract functions
    mohit07raghav19 committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    4d67ed9 View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2023

  1. Configuration menu
    Copy the full SHA
    910bb85 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    20bb9ee View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2023

  1. Configuration menu
    Copy the full SHA
    dec410b View commit details
    Browse the repository at this point in the history
  2. refractor : Updated the 'copy' function to return an empty matrix if …

    …an empty matrix is passed as input.
    mohit07raghav19 committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    a7e43d2 View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2023

  1. Configuration menu
    Copy the full SHA
    cabf07b View commit details
    Browse the repository at this point in the history
  2. Updated Documentation in README.md

    github-action authored and github-action committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    3c787c7 View commit details
    Browse the repository at this point in the history
  3. refactor: matrix operations to use context and sync packages

    Body:
    - Updated the Add,Subtract, SubMatrix, and Multiply functions in the matrix package to use the context and sync packages for goroutine management and error handling.
    - Removed the use of the errgroup package in these functions.
    mohit07raghav19 committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    fc232f2 View commit details
    Browse the repository at this point in the history
  4. refactor: matrix operations to use context and sync packages

    Body:
    - Updated the Add,Subtract, SubMatrix, and Multiply functions in the matrix package to use the context and sync packages for goroutine management and error handling.
    - Removed the use of the errgroup package in these functions.
    mohit07raghav19 committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    382b49f View commit details
    Browse the repository at this point in the history
  5. Updated Documentation in README.md

    github-action authored and github-action committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    51206f7 View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2023

  1. chore: Add empty commit to trigger actions

    The GoDoc action has stopped the execution of other actions. This empty commit is a workaround to trigger the other actions to run.
    mohit07raghav19 committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    24dcb8f View commit details
    Browse the repository at this point in the history