Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ObjectMatrices.cs
1using System;
5
7{
11 public sealed class ObjectMatrices : Ring
12 {
13 private readonly int rows;
14 private readonly int columns;
15
21 public ObjectMatrices(int Rows, int Columns)
22 {
23 this.rows = Rows;
24 this.columns = Columns;
25 }
26
30 public int Rows => this.rows;
31
35 public int Columns => this.columns;
36
40 public override IAbelianGroupElement Zero
41 {
42 get { throw new ScriptException("Zero element not defined for generic object matrices."); }
43 }
44
48 public override bool IsCommutative
49 {
50 get { return this.columns == 1 && this.rows == 1; }
51 }
52
58 public override bool Contains(IElement Element)
59 {
60 if (Element is ObjectMatrix M)
61 return M.Rows == this.rows && M.Columns == this.columns;
62 else
63 return false;
64 }
65
71 public override bool Equals(object obj)
72 {
73 return (obj is ObjectMatrices S && S.rows == this.rows && S.columns == this.columns);
74 }
75
80 public override int GetHashCode()
81 {
82 return this.rows.GetHashCode() ^ (this.columns.GetHashCode() << 16);
83 }
84
85 }
86}
Base class for all types of elements.
Definition: Element.cs:13
Base class for all types of rings.
Definition: Ring.cs:9
Base class for script exceptions.
Pseudo-ring of Object-valued matrices.
ObjectMatrices(int Rows, int Columns)
Pseudo-ring of Object-valued matrices.
override bool Contains(IElement Element)
Checks if the set contains an element.
override int GetHashCode()
Calculates a hash code of the element.
override IAbelianGroupElement Zero
Returns the zero element of the group.
override bool Equals(object obj)
Compares the element to another.
override bool IsCommutative
If the ring * operator is commutative or not.
Basic interface for all types of abelian group elements.
Basic interface for all types of elements.
Definition: IElement.cs:20