- accepts {{1},{2},{3}} + {{4},{5},{6}} and outputs {{5},{7},{9}}
- accepts {{1},{2},{3}} + 2 and outputs {{3},{4},{5}}
- accepts sin({pi, pi/2, -pi}) and outputs {0, 1, 0}
- and so on.

For every binary or nary operations, the vector dimension of the input nodes should match in size unless it is a scalar. As shown in the example, if you have a vector plus a scalar, then each entry will be incremented by the scalar value. For instance, the compiler

- rejects {{1},{2},{3}} + {{4}}
- rejects {1, 2, 3} + {{1},{2},{3}}
- and so on.

When there is an SIdRef object type, I check if the object has dimensions and, if so, I convert it to a vector. Otherwise, I convert it to a scalar.

Ultimately, the compiler needs to do absolute value, trigonometric operations, logical operations, arithmetic operations, floor, ceiling, fraction, inequalities, lambda function, piecewise function, logarithm operations, power, square root, selector...

I haven't implemented all of them, but I got a lot of them done. This compiler will be used in the remaining validation rule that specifies that states the vector dimensions should match unless it is a scalar.

In addition to the compiler, I updated the arrays specification to include a flattening algorithm. I discussed the algorithm with my mentors, Chris and Nico. There are a couple of things that needs to be fixed but the algorithm seem to be in the right track. Perhaps after polishing it a little bit, the algorithm will be good to go and I can start the implementation. The vector compiler can potentially be used in the flattening routine as well.

## No comments:

## Post a Comment