Zabulonov.MatrixLib
1.0.2
See the version list below for details.
dotnet add package Zabulonov.MatrixLib --version 1.0.2
NuGet\Install-Package Zabulonov.MatrixLib -Version 1.0.2
<PackageReference Include="Zabulonov.MatrixLib" Version="1.0.2" />
paket add Zabulonov.MatrixLib --version 1.0.2
#r "nuget: Zabulonov.MatrixLib, 1.0.2"
// Install Zabulonov.MatrixLib as a Cake Addin #addin nuget:?package=Zabulonov.MatrixLib&version=1.0.2 // Install Zabulonov.MatrixLib as a Cake Tool #tool nuget:?package=Zabulonov.MatrixLib&version=1.0.2
About MatrixLib
A simple library for working with matrices, contains the basic functionality and api that may be useful to you 😃
Changes in the new version 1.0.1
Major changes:
- NEW! MinorMatrix(); <br /> Returns a new minor matrix from an existing one.
- NEW! isSquare(); <br /> Returns boolean. Checks whether the matrix is square (rows == columns)
- Updated the documentation in the readme.
Installation
Package Manager
NuGet\Install-Package Zabulonov.MatrixLib -Version 1.0.1
.NET CLI
dotnet add package Zabulonov.MatrixLib --version 1.0.1
Working with the matrix
First, include the library:
using MatrixLib;
Creating a matrix
To create a matrix, just type:
Matrix matrix = new Matrix(rowsLength, columnsLength);
You can also create a matrix from a double[,] array:
double[,] arr1 = new double[3, 3] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 0 } };
Matrix m1 = new Matrix(arr1);
Accessing Matrix Elements
Implemented indexed access to matrix elements using matrixName[row, column]
For example:
Matrix m1 = new Matrix(arr1);
Console.WriteLine(m1[2,2]);
You can also run foreach
in the matrix, it will go through all the elements of the matrix.
foreach (var item in m1)
{
Console.WriteLine(item);
}
Operators
For ease of use, all operators have been overloaded: +, -, *, /, !=, ==
So for example you can use * to multiply 2 matrices or to multiply an entire matrix by a number:
var m3 = m1 * m2;
m3 *= 5;
Or if you want to compare 2 matrices or 2 matrix elements:
if (m1 == m2)
Console.WriteLine("true");
// - - -
if (m1[1,1] == m2[1,1])
Console.WriteLine("true");
Functions
Available Functions:
- isSquare(); <br /> Returns boolean. Checks whether the matrix is square (rows == columns)
- MinorMatrix(); <br /> Returns a new minor matrix from an existing one.
- Det();<br /> Returns a double, determine the current matrix. The matrix must be square!
- Equals();<br />
Returns boolean. Compares 2 matrices, you can also use the
==
operator. - GetHashCode();<br /> Returns unique(I hope) hash code
- GetRow(int number);<br /> Returns the selected row/column as a double array.
- GetColumn(int number);<br /> Returns the selected row/column as a double array.
- Transpose();<br /> Returns a new transposed matrix from the current one.
- ToDoubleArray();<br /> Converts the current matrix to a double array.
- CWGetMatrix();<br /> Displays the current matrix in the console.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Add 2 voids: AddAsRow() and AddAsColumn(); Updated the documentation on github