Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
BooleanVectors.cs
1using System;
4
6{
10 public sealed class BooleanVectors : VectorSpace
11 {
12 private static readonly BooleanValues scalarField = new BooleanValues();
13
14 private BooleanVector zero = null;
15 private readonly int dimension;
16
22 {
23 this.dimension = Dimension;
24 }
25
29 public int Dimension => this.dimension;
30
34 public override IField ScalarField
35 {
36 get { return scalarField; }
37 }
38
42 public override IAbelianGroupElement Zero
43 {
44 get
45 {
46 if (this.zero is null)
47 this.zero = new BooleanVector(new bool[this.dimension]);
48
49 return this.zero;
50 }
51 }
52
58 public override bool Contains(IElement Element)
59 {
60 if (Element is BooleanVector v)
61 return v.Dimension == this.dimension;
62 else
63 return false;
64 }
65
71 public override bool Equals(object obj)
72 {
73 return (obj is BooleanVectors v && v.dimension == this.dimension);
74 }
75
80 public override int GetHashCode()
81 {
82 return this.dimension.GetHashCode();
83 }
84
85 }
86}
Base class for all types of elements.
Definition: Element.cs:13
Base class for all types of vector spaces.
Definition: VectorSpace.cs:10
The field Z_2 of boolean numbers ([0]_2, 0 or false, and [1]_2, 1 or true).
Pseudo-vector space of Boolean-valued vectors.
BooleanVectors(int Dimension)
Pseudo-vector space of Boolean-valued vectors.
override bool Contains(IElement Element)
Checks if the set contains an element.
override IAbelianGroupElement Zero
Returns the zero element of the group.
override int GetHashCode()
Calculates a hash code of the element.
override bool Equals(object obj)
Compares the element to another.
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