Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Columns.cs
1using System;
2using System.Numerics;
8
10{
16 {
27 {
28 }
29
33 public override string FunctionName => nameof(Columns);
34
42 {
43 if (Argument is IMatrix M)
44 return new DoubleNumber(M.Columns);
45 else
46 return base.Evaluate(Argument, Variables);
47 }
48
56 {
57 double[] Values = Argument.Values;
58 int c = Values.Length;
59 int i, j;
60 double[,] Elements = new double[c, c];
61 double Value;
62
63 for (i = 0; i < c; i++)
64 {
65 Value = Values[i];
66 for (j = 0; j < c; j++)
67 Elements[i, j] = Value;
68 }
69
70 return new DoubleMatrix(Elements);
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[i, j] = 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[i, j] = 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[i, j++] = 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 columns have elements of the same value, each defined by the corresponding ele...
Definition: Columns.cs:16
override IElement EvaluateVector(ComplexVector Argument, Variables Variables)
Evaluates the function on a vector argument.
Definition: Columns.cs:79
override IElement EvaluateVector(BooleanVector Argument, Variables Variables)
Evaluates the function on a vector argument.
Definition: Columns.cs:103
override IElement EvaluateVector(DoubleVector Argument, Variables Variables)
Evaluates the function on a vector argument.
Definition: Columns.cs:55
override IElement EvaluateVector(IVector Argument, Variables Variables)
Evaluates the function on a vector argument.
Definition: Columns.cs:127
override IElement Evaluate(IElement Argument, Variables Variables)
Evaluates the function.
Definition: Columns.cs:41
override string FunctionName
Name of the function
Definition: Columns.cs:33
Columns(ScriptNode Argument, int Start, int Length, Expression Expression)
Creates a matrix whose columns have elements of the same value, each defined by the corresponding ele...
Definition: Columns.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