Updated to have all element wise tensor operations be an instance of the lin::internal::StreamElementWiseOperation<class F, class... Cs>class and be based off of functors.
Added more element wise operations (see include/lin/core/operations/operations.hpp) and operators (see include/lin/core/operations/operators.hpp).
Without writing a ton, there are a whole new set of element wise operation functions that include: lin::add, lin::divide, lin::multiply, lin::negate, lin::sign, lin::multiply, etc which will always perform an element wise operation.
For example, the following code is equivalent to using .* in MATLAB:
lin::Matrix2x2f A { ... }, B { ... };
lin::Matrix2x2f C = lin::multiply(A, B);
These functions can also take a scalar in as any argument to, as an example, add 5.0 to every element of a matrix/vector:
lin::Matrix2x2d A = { ... };
A = lin::add(5.0, A);
Most of the above operations can be expressed using operator overloads as well; for example, lin::add(5.0, A) is equivalent to 5.0 + A. There is, however, the notable exception regarding lin::multiply. A * B from the example above would perform matrix multiplication; lin::multiply must be used explicitly for element wise multiplication.
Ptest Effects
NA
Testing
Unit tests continue to pass
Constants
NA
Documentation Evidence
Still need to find some time to create some tutorials or something along those lines.
Updates to the
lin
SubmoduleSummary of changes
lin::internal::StreamElementWiseOperation<class F, class... Cs>
class and be based off of functors.include/lin/core/operations/operations.hpp
) and operators (seeinclude/lin/core/operations/operators.hpp
).Without writing a ton, there are a whole new set of element wise operation functions that include:
lin::add
,lin::divide
,lin::multiply
,lin::negate
,lin::sign
,lin::multiply
, etc which will always perform an element wise operation.For example, the following code is equivalent to using
.*
in MATLAB:These functions can also take a scalar in as any argument to, as an example, add
5.0
to every element of a matrix/vector:Most of the above operations can be expressed using operator overloads as well; for example,
lin::add(5.0, A)
is equivalent to5.0 + A
. There is, however, the notable exception regardinglin::multiply
.A * B
from the example above would perform matrix multiplication;lin::multiply
must be used explicitly for element wise multiplication.Ptest Effects
NA
Testing
Unit tests continue to pass
Constants
NA
Documentation Evidence
Still need to find some time to create some tutorials or something along those lines.