-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathVariableMatrix.cs
More file actions
60 lines (52 loc) · 1.98 KB
/
Copy pathVariableMatrix.cs
File metadata and controls
60 lines (52 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// VariableMatrix.cs, 07.11.2019
// Copyright (C) Dominic Beger 07.11.2019
using System;
using System.ComponentModel;
namespace SharpMath.Geometry
{
/// <summary>
/// Represents a matrix that can vary in its column and row count.
/// </summary>
internal sealed class VariableMatrix : IMatrix
{
private readonly double[,] _fields;
/// <summary>
/// Initializes a new instance of the <see cref="VariableMatrix" /> class.
/// </summary>
/// <param name="rowCount">The row count of the <see cref="VariableMatrix" />.</param>
/// <param name="columnCount">The column count of the <see cref="VariableMatrix" />.</param>
public VariableMatrix(uint rowCount, uint columnCount)
{
_fields = new double[rowCount, columnCount];
RowCount = rowCount;
ColumnCount = columnCount;
}
/// <summary>
/// Gets the column count of the <see cref="VariableMatrix" />.
/// </summary>
public uint ColumnCount { get; }
/// <summary>
/// Gets or sets the field value at the specified row and column indices.
/// </summary>
/// <param name="row">The row index.</param>
/// <param name="column">The column index.</param>
/// <returns>The field value at the specified row and column indices.</returns>
public double this[uint row, uint column]
{
get => _fields[row, column];
set => _fields[row, column] = value;
}
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Simple indexer is not supported in this class.", true)]
public double this[uint index]
{
get => double.NaN;
// ReSharper disable once ValueParameterNotUsed
set { }
}
/// <summary>
/// Gets the row count of the <see cref="VariableMatrix" />.
/// </summary>
public uint RowCount { get; }
}
}