2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 13:33:13 +00:00
This commit is contained in:
2023-04-04 18:38:28 +03:00
parent 5966598c9f
commit 0ceaee88aa
6 changed files with 76 additions and 6 deletions

View File

@ -9,14 +9,35 @@ namespace Esiur.Analysis.Graph
{
internal T[,] value;
public int Rows => value.GetLength(0);
public int Columns => value.GetLength(1);
public int Rows { get; private set; }
public int Columns { get; private set; }
public T this[int x, int y] => value[x, y];
public T this[int x, int y] {
get => value [x, y];
set => this.value[x, y] = value;
}
public Matrix(int rows, int columns)
{
value = new T[rows, columns];
}
public Matrix(T[,] value)
{
this.value = value;
Rows = value.GetLength(0);
Columns = value.GetLength(1);
}
public Matrix<T> Transpose()
{
var rt = new T[Columns, Rows];
for(var i = 0; i < Rows; i++)
for(var j = 0; j < Columns; j++)
rt[j, i] = value[i, j];
return new Matrix<T>(rt);
}
public static Matrix<T> operator *(Matrix<T> a, Matrix<T> b)