Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ComplexMatrices.cs
1using System;
2using System.Numerics;
5
7{
11 public sealed class ComplexMatrices : Ring
12 {
13 private ComplexMatrix zero = null;
14 private readonly int rows;
15 private readonly int columns;
16
22 public ComplexMatrices(int Rows, int Columns)
23 {
24 this.rows = Rows;
25 this.columns = Columns;
26 }
27
31 public int Rows => this.rows;
32
36 public int Columns => this.columns;
37
41 public override IAbelianGroupElement Zero
42 {
43 get
44 {
45 if (this.zero is null)
46 {
47 Complex[,] v = new Complex[this.rows, this.columns];
48 int x, y;
49
50 for (y = 0; y < this.rows; y++)
51 {
52 for (x = 0; x < this.columns; x++)
53 v[y, x] = Complex.Zero;
54 }
55
56 this.zero = new ComplexMatrix(v);
57 }
58
59 return this.zero;
60 }
61 }
62
66 public override bool IsCommutative
67 {
68 get { return this.columns == 1 && this.rows == 1; }
69 }
70
76 public override bool Contains(IElement Element)
77 {
78 if (Element is ComplexMatrix M)
79 return M.Rows == this.rows && M.Columns == this.columns;
80 else
81 return false;
82 }
83
89 public override bool Equals(object obj)
90 {
91 return (obj is ComplexMatrices S && S.rows == this.rows && S.columns == this.columns);
92 }
93
98 public override int GetHashCode()
99 {
100 return this.rows.GetHashCode() ^ (this.columns.GetHashCode() << 16);
101 }
102
103 }
104}
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 Complex-valued matrices.
override IAbelianGroupElement Zero
Returns the zero element of the group.
override int GetHashCode()
Calculates a hash code of the element.
override bool Contains(IElement Element)
Checks if the set contains an element.
override bool Equals(object obj)
Compares the element to another.
override bool IsCommutative
If the ring * operator is commutative or not.
ComplexMatrices(int Rows, int Columns)
Pseudo-ring of Complex-valued matrices.
Basic interface for all types of abelian group elements.
IAbelianGroupElement Zero
Returns the zero element of the group.
Basic interface for all types of elements.
Definition: IElement.cs:20