EllAlgo 1.6.13
Loading...
Searching...
No Matches
Classes | Functions
linear_algebra.hpp File Reference

Basic linear algebra utilities for vectors and matrices. More...

#include <cmath>
#include <vector>
Include dependency graph for linear_algebra.hpp:

Go to the source code of this file.

Classes

class  Vector2< T >
 A simple 2D vector class for linear algebra operations. More...
 
class  Matrix2< T >
 A simple 2D matrix class for linear algebra operations. More...
 

Functions

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

Detailed Description

Basic linear algebra utilities for vectors and matrices.

This header provides simple vector and matrix classes for basic linear algebra operations. These are lightweight implementations designed specifically for the ellalgo library.

Function Documentation

◆ operator*() [1/2]

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

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

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

◆ operator*() [2/2]

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

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

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

◆ operator+()

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

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

Parameters
lhsThe Vector2 to add the elements of the given Vector2 to.
rhsThe Vector2 to add to the elements of the given Vector2.
Returns
The resulting Vector2 after the addition.

◆ operator-()

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

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

Parameters
lhsThe Vector2 to subtract the elements of the given Vector2 from.
rhsThe Vector2 to subtract from the elements of the given Vector2.
Returns
The resulting Vector2 after the subtraction.