Syntax
Vectors.find(e, v);
Vectors.find(e, v, eps=0);
Description
The function call "Vectors.find(e, v)" returns true if input e is in vector v. The test of equality is performed by "abs(e-v[i]) ≤ eps", where "eps" can be provided as third argument of the function. Default is "eps = 0".
Example
Real v[3] = {1, 2, 3};
Real e1 = 2;
Real e2 = 3.01;
Boolean result;
algorithm
result := Vectors.find(e1,v); // = true
result := Vectors.find(e2,v); // = false
result := Vectors.find(e2,v,eps=0.1); // = true
See also
function exists extends Modelica.Icons.Function; input Real e "Search for e"; input Real v[:] "Real vector"; input Real eps(min = 0) = 0 "Element e is equal to a element v[i] of vector v if abs(e-v[i]) <= eps"; output Boolean result "=true if e in v else false"; end exists;