{"id":20031750,"url":"https://github.com/astrodynamic/matrix-library-in-cpp","last_synced_at":"2025-08-07T14:39:15.920Z","repository":{"id":162471415,"uuid":"637016096","full_name":"Astrodynamic/Matrix-Library-in-CPP","owner":"Astrodynamic","description":"Matrix Library is a C++ library for matrix operations such as addition, subtraction, multiplication, transpose, and more. It provides a Matrix class with constructors, destructors, and overloaded operators. The library can be built using CMake and depends on the Google Test framework for unit testing.","archived":false,"fork":false,"pushed_at":"2023-05-06T08:47:07.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-01-12T18:09:44.708Z","etag":null,"topics":["cmake","cpp","cpp17","library","makefile","matrix","matrix-library","testing"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Astrodynamic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-06T08:45:00.000Z","updated_at":"2023-05-10T11:36:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a39ae25-2ab4-477b-ad03-c7b525a0c11f","html_url":"https://github.com/Astrodynamic/Matrix-Library-in-CPP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astrodynamic%2FMatrix-Library-in-CPP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astrodynamic%2FMatrix-Library-in-CPP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astrodynamic%2FMatrix-Library-in-CPP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astrodynamic%2FMatrix-Library-in-CPP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Astrodynamic","download_url":"https://codeload.github.com/Astrodynamic/Matrix-Library-in-CPP/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241462617,"owners_count":19966895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmake","cpp","cpp17","library","makefile","matrix","matrix-library","testing"],"created_at":"2024-11-13T09:34:35.667Z","updated_at":"2025-03-02T05:24:40.465Z","avatar_url":"https://github.com/Astrodynamic.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Matrix Library\n\nThis is a C++ library that provides a Matrix class with various matrix operations, such as addition, subtraction, multiplication, and more.\n\n## Building the Project\n\nTo build the project, you can use CMake. Here are the steps to build the project:\n\n1. Clone the repository to your local machine.\n2. Navigate to the project directory\n3. Run `make`\n\n## Reusing and Compiling with Other Projects\n\nTo use this library in your own C++ project, simply link against the `Matrix.a` library file generated in the lib directory.\n\n## Dependencies\n\nThis project depends on the Google Test framework for unit testing. CMake will download and build this dependency automatically when building the project.\n\n## Running Tests\n\nTo run the unit tests for this library, navigate to the `build` directory and run the following command:\n\n```\nmake tests\n```\n\n## Matrix operations\n\nThere is a brief description of the matrix operations below that need to be implemented in the developing library.\nThey are similar to the operations you performed earlier in «structured programming», so you can see a more detailed description of them there.\nNote that some operations have exceptional situations that require special handling using the exception mechanism.\n\n| Operation | Description | Exceptional situations |\n| ----------- | ----------- | ----------- |\n| `bool eq_matrix(const Matrix\u0026 other)` | Checks matrices for equality with each other |  |\n| `void sum_matrix(const Matrix\u0026 other)` | Adds the second matrix to the current one | different matrix dimensions |\n| `void sub_matrix(const Matrix\u0026 other)` | Subtracts another matrix from the current one | different matrix dimensions |\n| `void mul_number(const double num) ` | Multiplies the current matrix by a number |  |\n| `void mul_matrix(const Matrix\u0026 other)` | Multiplies the current matrix by the second matrix | the number of columns of the first matrix is not equal to the number of rows of the second matrix |\n| `Matrix transpose()` | Creates a new transposed matrix from the current one and returns it |  |\n| `Matrix calc_complements()` | Calculates the algebraic addition matrix of the current one and returns it | the matrix is not square |\n| `double determinant()` | Calculates and returns the determinant of the current matrix | the matrix is not square |\n| `Matrix inverse_matrix()` | Calculates and returns the inverse matrix | matrix determinant is 0 |\n\nApart from those operations, you also need to implement constructors and destructors:\n\n| Method | Description |\n| ----------- | ----------- |\n| `Matrix()` | A basic constructor that initialises a matrix of some predefined dimension |  \n| `Matrix(int rows, int cols) ` | Parametrized constructor with number of rows and columns |\n| `Matrix(const Matrix\u0026 other)` | Copy constructor |\n| `Matrix(Matrix\u0026\u0026 other)` | Move constructor |\n| `~Matrix()` | Destructor |\n\nAnd you also need to overload the following operators, partly corresponding to the operations above:\n\n| Operator | Description | Exceptional situations |\n| ----------- | ----------- | ----------- |\n| `+`      | Addition of two matrices | different matrix dimensions |\n| `-`   | Subtraction of one matrix from another | different matrix dimensions |\n| `*`  | Matrix multiplication and matrix multiplication by a number | the number of columns of the first matrix does not equal the number of rows of the second matrix |\n| `==`  | Checks for matrices equality (`eq_matrix`) | |\n| `=`  | Assignment of values from one matrix to another one | |\n| `+=`  | Addition assignment (`sum_matrix`) | different matrix dimensions |\n| `-=`  | Difference assignment (`sub_matrix`) | different matrix dimensions |\n| `*=`  | Multiplication assignment (`mul_matrix`/`mul_number`) | the number of columns of the first matrix does not equal the number of rows of the second matrix |\n| `(int i, int j)`  | Indexation by matrix elements (row, column) | index is outside the matrix |\n\n\n\n## Examples\n\nHere is an example of how to use the Matrix class to perform matrix operations:\n\n```\n#include \"matrix.h\"\n\nint main() {\n  Matrix m1(2, 3);\n  Matrix m2(3, 2);\n\n  m1(0, 0) = 1;\n  m1(0, 1) = 2;\n  m1(0, 2) = 3;\n  m1(1, 0) = 4;\n  m1(1, 1) = 5;\n  m1(1, 2) = 6;\n\n  m2(0, 0) = 7;\n  m2(0, 1) = 8;\n  m2(1, 0) = 9;\n  m2(1, 1) = 10;\n  m2(2, 0) = 11;\n  m2(2, 1) = 12;\n\n  Matrix m3 = m1 * m2;\n  m3.print();\n}\n```\n\nThis will create two matrices, set their values, multiply them, and print the resulting matrix.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrodynamic%2Fmatrix-library-in-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastrodynamic%2Fmatrix-library-in-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrodynamic%2Fmatrix-library-in-cpp/lists"}