ellalgo/linear_algebra.hpp file

Classes

template<typename T>
class Vector2
template<typename T>
class Matrix2

Functions

template<typename T>
auto operator+(Vector2<T> lhs, const Vector2<T>& rhs) -> Vector2<T>
template<typename T>
auto operator-(Vector2<T> lhs, const Vector2<T>& rhs) -> Vector2<T>
template<typename T>
auto operator*(Vector2<T> v, T scalar) -> Vector2<T>
template<typename T>
auto operator*(T scalar, Vector2<T> v) -> Vector2<T>

Function documentation

template<typename T>
Vector2<T> operator+(Vector2<T> lhs, const Vector2<T>& rhs)

Parameters
lhs The Vector2 to add the elements of the given Vector2 to.
rhs The Vector2 to add to the elements of the given Vector2.
Returns The resulting Vector2 after the addition.

Adds the elements of the given Vector2 to the corresponding elements of this Vector2.

template<typename T>
Vector2<T> operator-(Vector2<T> lhs, const Vector2<T>& rhs)

Parameters
lhs The Vector2 to subtract the elements of the given Vector2 from.
rhs The Vector2 to subtract from the elements of the given Vector2.
Returns The resulting Vector2 after the subtraction.

Subtracts the elements of the given Vector2 from the corresponding elements of this Vector2.

template<typename T>
Vector2<T> operator*(Vector2<T> v, T scalar)

Parameters
v The Vector2 to multiply by the scalar.
scalar The scalar value to multiply the Vector2 by.
Returns The resulting Vector2 after the multiplication.

Multiplies the elements of the given Vector2 by the given scalar value.

template<typename T>
Vector2<T> operator*(T scalar, Vector2<T> v)

Parameters
scalar The scalar value to multiply the Vector2 by.
v The Vector2 to multiply by the scalar.
Returns The resulting Vector2 after the multiplication.

Multiplies the given scalar value by the elements of the given Vector2.