Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Rows.cs
1using System;
2using System.Numerics;
8
10{
16 {
27 {
28 }
29
33 public override string FunctionName => nameof(Rows);
34
42 {
43 double[] Values = Argument.Values;
44 int c = Values.Length;
45 int i, j;
46 double[,] Elements = new double[c, c];
47 double Value;
48
49 for (i = 0; i < c; i++)
50 {
51 Value = Values[i];
52 for (j = 0; j < c; j++)
53 Elements[j, i] = Value;
54 }
55
56 return new DoubleMatrix(Elements);
57 }
58
66 {
67 if (Argument is IMatrix M)
68 return new DoubleNumber(M.Rows);
69 else
70 return base.Evaluate(Argument, Variables);
71 }
72
80 {
81 Complex[] Values = Argument.Values;
82 int c = Values.Length;
83 int i, j;
84 Complex[,] Elements = new Complex[c, c];
85 Complex Value;
86
87 for (i = 0; i < c; i++)
88 {
89 Value = Values[i];
90 for (j = 0; j < c; j++)
91 Elements[j, i] = Value;
92 }
93
94 return new ComplexMatrix(Elements);
95 }
96
104 {
105 Boolean[] Values = Argument.Values;
106 int c = Values.Length;
107 int i, j;
108 Boolean[,] Elements = new Boolean[c, c];
109 Boolean Value;
110
111 for (i = 0; i < c; i++)
112 {
113 Value = Values[i];
114 for (j = 0; j < c; j++)
115 Elements[j, i] = Value;
116 }
117
118 return new BooleanMatrix(Elements);
119 }
120
128 {
129 int c = Argument.Dimension;
130 int i, j;
131 IElement[,] Elements = new IElement[c, c];
132
133 for (i = 0; i < c; i++)
134 {
135 j = 0;
136 foreach (IElement Value in Argument.VectorElements)
137 Elements[j++, i] = Value;
138 }
139
140 return new ObjectMatrix(Elements);
141 }
142
143 }
144}
Class managing a script expression.
Definition: Expression.cs:39
Creates a matrix whose rows have elements of the same value, each defined by the corresponding elemen...
Definition: Rows.cs:16
override IElement EvaluateVector(ComplexVector Argument, Variables Variables)
Evaluates the function on a vector argument.
Definition: Rows.cs:79
override IElement EvaluateVector(DoubleVector Argument, Variables Variables)
Evaluates the function on a vector argument.
Definition: Rows.cs:41
override IElement Evaluate(IElement Argument, Variables Variables)
Evaluates the function.
Definition: Rows.cs:65
override string FunctionName
Name of the function
Definition: Rows.cs:33
override IElement EvaluateVector(IVector Argument, Variables Variables)
Evaluates the function on a vector argument.
Definition: Rows.cs:127
override IElement EvaluateVector(BooleanVector Argument, Variables Variables)
Evaluates the function on a vector argument.
Definition: Rows.cs:103
Rows(ScriptNode Argument, int Start, int Length, Expression Expression)
Creates a matrix whose rows have elements of the same value, each defined by the corresponding elemen...
Definition: Rows.cs:25
ScriptNode Argument
Function argument.
Base class for funcions of one vector variable.
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
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20
Basic interface for matrices.
Definition: IMatrix.cs:9
Basic interface for vectors.
Definition: IVector.cs:9