Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
CartesianProduct.cs
6
8{
13 {
23 : base(Left, Right, Start, Length, Expression)
24 {
25 }
26
35 {
36 if (Left.Dimension != Right.Dimension)
37 throw new ScriptRuntimeException("Vectors of different dimensions.", this);
38
40 IEnumerator<IElement> e1 = Left.VectorElements.GetEnumerator();
41 IEnumerator<IElement> e2 = Right.VectorElements.GetEnumerator();
42 IElement v1;
43
44 try
45 {
46 while (e1.MoveNext())
47 {
48 v1 = e1.Current;
49 while (e2.MoveNext())
50 Elements.Add(VectorDefinition.Encapsulate(new IElement[] { v1, e2.Current }, false, this));
51
52 e2.Reset();
53 }
54
55 return VectorDefinition.Encapsulate(Elements, false, this);
56 }
57 finally
58 {
59 e1.Dispose();
60 e2.Dispose();
61 }
62 }
63 }
64}
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
void Add(T Item)
Adds an item to the collection.
Definition: ChunkedList.cs:272
Class managing a script expression.
Definition: Expression.cs:41
Base class for binary vector operators.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
CartesianProduct(ScriptNode Left, ScriptNode Right, int Start, int Length, Expression Expression)
Cartesian-product operator.
override IElement EvaluateVector(IVector Left, IVector Right, Variables Variables)
Evaluates the operator on vector operands.
static IElement Encapsulate(Array Elements, bool CanEncapsulateAsMatrix, ScriptNode Node)
Encapsulates the elements of a vector.
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:21
Basic interface for vectors.
Definition: IVector.cs:9
ICollection< IElement > VectorElements
An enumeration of vector elements.
Definition: IVector.cs:22
int Dimension
Dimension of vector.
Definition: IVector.cs:14