Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ComplexVectors.cs
1using System;
2using System.Numerics;
5
7{
11 public sealed class ComplexVectors : VectorSpace
12 {
13 private static readonly ComplexNumbers scalarField = new ComplexNumbers();
14
15 private ComplexVector zero = null;
16 private readonly int dimension;
17
23 {
24 this.dimension = Dimension;
25 }
26
30 public int Dimension => this.dimension;
31
35 public override IField ScalarField
36 {
37 get { return scalarField; }
38 }
39
43 public override IAbelianGroupElement Zero
44 {
45 get
46 {
47 if (this.zero is null)
48 {
49 Complex[] v = new Complex[this.dimension];
50 int i;
51
52 for (i = 0; i < this.dimension; i++)
53 v[i] = Complex.Zero;
54
55 this.zero = new ComplexVector(v);
56 }
57
58 return this.zero;
59 }
60 }
61
67 public override bool Contains(IElement Element)
68 {
69 if (Element is ComplexVector v)
70 return v.Dimension == this.dimension;
71 else
72 return false;
73 }
74
80 public override bool Equals(object obj)
81 {
82 return (obj is ComplexVectors v && v.dimension == this.dimension);
83 }
84
89 public override int GetHashCode()
90 {
91 return this.dimension.GetHashCode();
92 }
93
94 }
95}
Base class for all types of elements.
Definition: Element.cs:13
Base class for all types of vector spaces.
Definition: VectorSpace.cs:10
Pseudo-field of Complex numbers, as an approximation of the field of real numbers.
Pseudo-vector space of Complex-valued vectors.
ComplexVectors(int Dimension)
Pseudo-vector space of Complex-valued vectors.
override bool Equals(object obj)
Compares the element to another.
override int GetHashCode()
Calculates a hash code of the element.
override bool Contains(IElement Element)
Checks if the set contains an element.
override IAbelianGroupElement Zero
Returns the zero element of the group.
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
Basic interface for all types of fields.
Definition: IField.cs:9