Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Ones.cs
1using System;
6
8{
13 {
21 public Ones(ScriptNode Dimension, int Start, int Length, Expression Expression)
22 : base(Dimension, Start, Length, Expression)
23 {
24 }
25
29 public override string FunctionName => nameof(Ones);
30
38 {
39 int N = (int)Argument;
40
41 if (N != Argument || N < 0)
42 throw new ScriptRuntimeException("Dimension must be a non-negative integer.", this);
43
44 double[] E = new double[N];
45 int i;
46
47 for (i = 0; i < N; i++)
48 E[i] = 1;
49
50 return new DoubleVector(E);
51 }
52 }
53}
Class managing a script expression.
Definition: Expression.cs:39
Creates a vector containing only ones.
Definition: Ones.cs:13
override IElement EvaluateScalar(double Argument, Variables Variables)
Evaluates the function on a scalar argument.
Definition: Ones.cs:37
Ones(ScriptNode Dimension, int Start, int Length, Expression Expression)
Creates a vector containing only ones.
Definition: Ones.cs:21
override string FunctionName
Name of the function
Definition: Ones.cs:29
Base class for funcions of one scalar variable.
ScriptNode Argument
Function argument.
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