Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DoubleVectors.cs
1using System;
4
6{
10 public sealed class DoubleVectors : VectorSpace
11 {
12 private DoubleVector zero = null;
13 private readonly int dimension;
14
20 {
21 this.dimension = Dimension;
22 }
23
27 public int Dimension => this.dimension;
28
32 public override IField ScalarField
33 {
34 get { return DoubleNumbers.Instance; }
35 }
36
40 public override IAbelianGroupElement Zero
41 {
42 get
43 {
44 if (this.zero is null)
45 this.zero = new DoubleVector(new double[this.dimension]);
46
47 return this.zero;
48 }
49 }
50
56 public override bool Contains(IElement Element)
57 {
58 if (!(Element is DoubleVector v))
59 return false;
60
61 return v.Dimension == this.dimension;
62 }
63
69 public override bool Equals(object obj)
70 {
71 return (obj is DoubleVectors v && v.dimension == this.dimension);
72 }
73
78 public override int GetHashCode()
79 {
80 return this.dimension.GetHashCode();
81 }
82
83 }
84}
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 double numbers, as an approximation of the field of real numbers.
static readonly DoubleNumbers Instance
Instance of the set of complex numbers.
Pseudo-vector space of Double-valued vectors.
override bool Equals(object obj)
Compares the element to another.
override bool Contains(IElement Element)
Checks if the set contains an element.
int Dimension
Dimension of vector space.
override IField ScalarField
Scalar field.
override int GetHashCode()
Calculates a hash code of the element.
DoubleVectors(int Dimension)
Pseudo-vector space of Double-valued vectors.
override IAbelianGroupElement Zero
Returns the zero element of the group.
Basic interface for all types of abelian group elements.
Basic interface for all types of elements.
Definition: IElement.cs:20
Basic interface for all types of fields.
Definition: IField.cs:9