Numerinus.Algebra 1.0.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Numerinus.Algebra --version 1.0.1
                    
NuGet\Install-Package Numerinus.Algebra -Version 1.0.1
                    
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="Numerinus.Algebra" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Numerinus.Algebra" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Numerinus.Algebra" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Numerinus.Algebra --version 1.0.1
                    
#r "nuget: Numerinus.Algebra, 1.0.1"
                    
#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.
#:package Numerinus.Algebra@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Numerinus.Algebra&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Numerinus.Algebra&version=1.0.1
                    
Install as a Cake Tool

Here's the improved README.md file, incorporating the new content while maintaining the existing structure and information:

Numerinus.Algebra ??

Linear algebra module for the Numerinus mathematical suite. Built on top of Numerinus.Core, this package provides a fully generic Matrix<T> type that works with any numeric type implementing IArithmetic<T> � including Scalar, ComplexNumber, and any custom type you define.


Features

  • Generic MatrixMatrix<T> works with any IArithmetic<T> type.
  • Operator Overloads � Use natural +, -, * syntax directly on matrices.
  • Type-Safe Arithmetic � All cell-level math is delegated to T.Add, T.Multiply, etc.
  • Dimension Validation � Built-in guards for incompatible matrix operations.

Project Structure

Numerinus.Algebra/ ??? Matrices/ ??? Matrix.cs ? Generic matrix type with arithmetic operators


Quick Start

Scalar Matrix

using Numerinus.Algebra.Matrices; using Numerinus.Core.Numerics;

// Create two 2x2 Scalar matrices var a = new Matrix<Scalar>(2, 2); a[0, 0] = 1; a[0, 1] = 2; a[1, 0] = 3; a[1, 1] = 4;

var b = new Matrix<Scalar>(2, 2); b[0, 0] = 5; b[0, 1] = 6; b[1, 0] = 7; b[1, 1] = 8;

var sum = a + b; // addition var diff = a - b; // subtraction var product = a * b; // multiplication

Console.WriteLine(product); // Matrix (2x2)

ComplexNumber Matrix

using Numerinus.Algebra.Matrices; using Numerinus.Core.Numerics;

var m = new Matrix<ComplexNumber>(2, 2); m[0, 0] = new ComplexNumber(1, 2); m[0, 1] = new ComplexNumber(3, 4); m[1, 0] = new ComplexNumber(5, 6); m[1, 1] = new ComplexNumber(7, 8);

var result = m * m; // multiplies using complex number arithmetic Console.WriteLine(result); // Matrix (2x2)


API Reference

Matrix<T>Numerinus.Algebra.Matrices

A generic two-dimensional matrix where T must implement IArithmetic<T>.

Constructor

var matrix = new Matrix<T>(int rows, int cols);

Throws ArgumentException if rows or cols is less than or equal to zero.

Properties
Property Type Description
Rows int Number of rows
Columns int Number of columns
Indexer

T value = matrix[row, col]; // get matrix[row, col] = value; // set

Operators
Operator Requirement Description
+ Same dimensions Adds corresponding elements
- Same dimensions Subtracts corresponding elements
* left.Columns == right.Rows Standard matrix multiplication

How Matrix Multiplication Works

For matrices A (m�n) and B (n�p), each cell of the result C (m�p) is:

C[i, j] = ? A[i, k] � B[k, j] for k = 0 ? n-1

Using IArithmetic<T>, this is implemented generically:

T sum = T.Zero; for (int k = 0; k < left.Columns; k++) { T product = T.Multiply(left[i, k], right[k, j]); sum = T.Add(sum, product); } result[i, j] = sum;

This means the same algorithm handles Scalar, ComplexNumber, or any future numeric type automatically.


Dimension Rules

Operation Rule Error if violated
Addition + Rows and Columns must match ArgumentException
Subtraction - Rows and Columns must match ArgumentException
Multiplication * left.Columns must equal right.Rows ArgumentException

Using a Custom Numeric Type

Any type implementing IArithmetic<T> from Numerinus.Core can be used as the element type:

public class MyNumber : IArithmetic<MyNumber> { // implement Add, Subtract, Multiply, Divide, Zero, One, IsZero }

var matrix = new Matrix<MyNumber>(3, 3);


Module Description
Numerinus.Core IArithmetic<T>, Scalar, ComplexNumber, Accuracy
Numerinus.Geometry Geometric types and transformations
Numerinus.Statistics Statistical functions and distributions

Contributing

We welcome contributions to the Numerinus.Algebra project! If you have suggestions for improvements or new features, please open an issue or submit a pull request.

How to Contribute

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them.
  4. Push your branch to your forked repository.
  5. Open a pull request against the main repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Changes Made:

  1. Added a Contributing Section: Encouraged community involvement and provided a clear process for contributions.
  2. Added a License Section: Included a standard license section to clarify the project's licensing.
  3. Maintained Structure: Ensured that the new content fits seamlessly into the existing structure of the README.
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.3 103 4/6/2026
1.1.2 107 4/6/2026
1.1.1 103 4/3/2026
1.1.0 465 3/28/2026
1.0.2 283 3/27/2026
1.0.1 125 3/26/2026
1.0.0 99 3/25/2026