Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DoubleMatrices.cs
1using System;
4
6{
10 public sealed class DoubleMatrices : Ring
11 {
12 private DoubleMatrix zero = null;
13 private readonly int rows;
14 private readonly int columns;
15
21 public DoubleMatrices(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
43 {
44 if (this.zero is null)
45 this.zero = new DoubleMatrix(new double[this.rows, this.columns]);
46
47 return this.zero;
48 }
49 }
50
54 public override bool IsCommutative
55 {
56 get { return this.columns == 1 && this.rows == 1; }
57 }
58
64 public override bool Contains(IElement Element)
65 {
66 if (Element is DoubleMatrix M)
67 return M.Rows == this.rows && M.Columns == this.columns;
68 else
69 return false;
70 }
71
77 public override bool Equals(object obj)
78 {
79 return (obj is DoubleMatrices S && S.rows == this.rows && S.columns == this.columns);
80 }
81
86 public override int GetHashCode()
87 {
88 return this.rows.GetHashCode() ^ (this.columns.GetHashCode() << 16);
89 }
90
91 }
92}
Base class for all types of elements.
Definition: Element.cs:13
Base class for all types of rings.
Definition: Ring.cs:9
Pseudo-ring of Double-valued matrices.
override bool IsCommutative
If the ring * operator is commutative or not.
DoubleMatrices(int Rows, int Columns)
Pseudo-ring of Double-valued matrices.
override int GetHashCode()
Calculates a hash code of the element.
override bool Equals(object obj)
Compares the element to another.
override IAbelianGroupElement Zero
Returns the zero element of the group.
override bool Contains(IElement Element)
Checks if the set contains an element.
Basic interface for all types of abelian group elements.
Basic interface for all types of elements.
Definition: IElement.cs:20