https://github.com/zonel/matrix2dlib
🧮 class that allows you to define and implement the functionality of a 2D matrices. It provides a convenient and efficient way to work with matrices, supporting various operations and calculations.
https://github.com/zonel/matrix2dlib
csharp dotnet matrix
Last synced: 7 months ago
JSON representation
🧮 class that allows you to define and implement the functionality of a 2D matrices. It provides a convenient and efficient way to work with matrices, supporting various operations and calculations.
- Host: GitHub
- URL: https://github.com/zonel/matrix2dlib
- Owner: zonel
- Created: 2023-03-26T11:13:50.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-21T11:22:19.000Z (over 2 years ago)
- Last Synced: 2025-05-17T05:34:20.164Z (9 months ago)
- Topics: csharp, dotnet, matrix
- Language: C#
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Matrix2D

**Matrix2D is a class that allows you to define and implement the functionality of a 2D matrices. This class provides a convenient and efficient way to work with matrices, supporting various operations and calculations.**
## Features
- Define and manipulate 2D arrays easily with the Matrix2D class.
- Implements overloads for `ToString()`, `IEquatable`, and all arithmetic operators such as `+`, `-`, and `*`.
- Custom functions like `Determinant(A)` and `Det()` are provided to calculate the determinant of the matrix.
## Installation
You can simply clone the repository or download the source code and include it in your project.
```bash
git clone https://github.com/zoneel/Matrix2D.git
```
## Usage
First, include the Matrix2D class in your project:
```csharp
using Matrix2D;
```
To create a new matrix, initialize an instance of the Matrix2D class:
```csharp
Matrix2D matrix = new Matrix2D(a,b,c,d);
```
Perform operations on the matrix using the available methods and operators:
```csharp
Matrix2D matrixA = new Matrix2D(1,2,3,4);
Matrix2D matrixB = new Matrix2D(5,6,7,8);
Matrix2D result = matrixA + matrixB;
```
You can also use the provided custom functions to calculate the determinant:
```csharp
Matrix2D matrix = new Matrix2D(7,2,4,5);
double determinant = matrix.Determinant();
```
## Examples
Here are a few examples to illustrate the usage of the Matrix2D class:
```csharp
Matrix2D matrixA = new Matrix2D(1,2,3,4);
matrixA.A = 1;
matrixA.B = 2;
matrixA.C = 3;
matrixA.D = 4;
Matrix2D matrixB = new Matrix2D(1,2,3,4);
matrixA.A = 1;
matrixA.B = 2;
matrixA.C = 3;
matrixA.D = 4;
Matrix2D result = matrixA + matrixB;
Console.WriteLine(result.ToString());
```
Output:
```
[[1, 2], [3, 4]]
```
## Contributing
Contributions are welcome! If you find any issues or have suggestions, feel free to open an issue or submit a pull request.
## License
This project is licensed under the MIT License.
---
**Note:** **This project is for educational purposes and may not be suitable for production environments.**