Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Rank.cs
5
7{
12 {
22 {
23 }
24
28 public override string FunctionName => nameof(Rank);
29
37 {
38 if (Argument is IMatrix M)
39 {
40 if (M.Reduce(false, false, out int Rank, out _) is null || Rank < 0)
41 throw new ScriptRuntimeException("Unable to compute rank of matrix.", this);
42
43 return new DoubleNumber(Rank);
44 }
45 else
46 throw new ScriptRuntimeException("Expected matrix argument.", this);
47 }
48 }
49}
Class managing a script expression.
Definition: Expression.cs:39
Rank(ScriptNode Argument, int Start, int Length, Expression Expression)
Rank(x)
Definition: Rank.cs:20
override string FunctionName
Name of the function
Definition: Rank.cs:28
override IElement Evaluate(IElement Argument, Variables Variables)
Evaluates the function.
Definition: Rank.cs:36
Base class for funcions of one 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
Basic interface for matrices.
Definition: IMatrix.cs:9