Zabulonov.MatrixLib 1.0.3

dotnet add package Zabulonov.MatrixLib --version 1.0.3
NuGet\Install-Package Zabulonov.MatrixLib -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Zabulonov.MatrixLib" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Zabulonov.MatrixLib --version 1.0.3
#r "nuget: Zabulonov.MatrixLib, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Zabulonov.MatrixLib as a Cake Addin
#addin nuget:?package=Zabulonov.MatrixLib&version=1.0.3

// Install Zabulonov.MatrixLib as a Cake Tool
#tool nuget:?package=Zabulonov.MatrixLib&version=1.0.3

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.2!

Major changes:

  • NEW! AddAsRow();<br /> Updates the current matrix by replacing the selected row with a double array.
  • NEW! AddAsColumn();<br /> Updates the current matrix by replacing the selected column with a double array.
  • Updated the documentation in the readme.

Installation

Package Manager

NuGet\Install-Package Zabulonov.MatrixLib -Version 1.0.2

.NET CLI

dotnet add package Zabulonov.MatrixLib --version 1.0.2

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.
  • AddAsRow();<br /> Updates the current matrix by replacing the selected row with a double array.
  • AddAsColumn();<br /> Updates the current matrix by replacing the selected column with a double array.
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last updated
1.0.3 276 1/28/2023
1.0.2 276 12/31/2022
1.0.1 370 10/25/2022
1.0.0 354 10/14/2022

Fixed a critical bug with multiplication of two matrices! Updated the documentation on github