Implemented vector and matrix operations
rlang: protect against nan, +inf and -inf