Scalars, Vectors, Matrices and Lists - Waigo01/math_utils_lib GitHub Wiki
Vectors and Matrices are written in square brackets (e.g. [3, 4, 5]
and [[3, 4, 5], [6, 2, 3], [2, 1, 9]]
). Matrices are by default column major. This behavior can however be changed by enabling the feature row-major
in Cargo.toml. Both Vectors and Matrices also allow for calculations as their entries (e.g. [3/2, 7*2, sqrt(9)]
).
The evaluator function always evaluates an AST in terms of multiple values. If for example an equation solver process returns two distinct results the evaluator will continue to apply all following operations on both results and return those results. You can also add multiple values manually by constructing a list of values (e.g. {3, 4, 5}
).
As an example of the multiple values approach of the evaluator, consider the following expression: 3+{3, 2, 1}
. For each entry in the list the evaluator will add 3. The results will therefore be: {6, 5, 4}
.
If vectors or matrices contain entries with multiple values all possible combinations (cartesian product) of these values within the vector will be used for the next operation (e.g. [{1, 2}, {4, 2}, 0]
= {[1, 4, 0], [1, 2, 0], [2, 4, 0], [2, 2, 0]}
).