PTEMS  0.1.0-dev+git.81fd0e4
PolyTopic Element Method Solver
ptems::BasicVector< T, DIM > Struct Template Reference

Vector representing a point in DIM-dimensional space. More...

#include <ptems/vector.hpp>

Public Types

using ConjugateType = BasicVector< typename std::conditional_t< is_complex_v< T >, T, std::complex< T > >, DIM >
 The type of the conjugate of the vector. More...
 

Public Member Functions

constexpr BasicVector ()
 Construct a zero vector. More...
 
constexpr BasicVector (T value)
 Construct a vector with all components equal to the specified value. More...
 
template<typename... F, typename = std::enable_if_t<sizeof...(F) == DIM>>
constexpr BasicVector (F... pt)
 Construct a vector for the specified point. More...
 
template<typename U >
constexpr BasicVector (const BasicVector< U, DIM > rhs)
 Construct a vector by copying the specified vector. More...
 
template<typename U >
constexpr BasicVectoroperator= (const BasicVector< U, DIM > rhs)
 Copy the specified vector to this. More...
 
constexpr BasicVectoroperator= (T rhs)
 Set all components tof vector equal to a constants. More...
 
constexpr BasicVectoroperator+= (T rhs)
 Adds a constant to every component to this vector. More...
 
template<typename U >
constexpr BasicVectoroperator+= (const BasicVector< U, DIM > &rhs)
 Adds another vector to this vector. More...
 
constexpr BasicVectoroperator-= (T rhs)
 Subtracts constant from every component to this vector. More...
 
template<typename U >
constexpr BasicVectoroperator-= (const BasicVector< U, DIM > &rhs)
 Subtracts another vector to this vector. More...
 
template<typename U >
constexpr BasicVectoroperator/= (U rhs)
 Divides all components of this vector by a constant. More...
 
template<typename U >
constexpr BasicVectoroperator/= (const BasicVector< U, DIM > &rhs)
 Performs elementwise division of all components of this vector by the other vector. More...
 
template<typename U >
constexpr BasicVectoroperator*= (U rhs)
 Multiplies all components of this vector by a constant. More...
 
template<typename U >
constexpr BasicVectoroperator*= (const BasicVector< U, DIM > &rhs)
 Performs elementwise multiplication of all components of this vector by the other vector. More...
 
constexpr BasicVector operator- () const
 Returns the negated vector. More...
 
template<typename U >
constexpr std::common_type_t< T, U > Dot (const BasicVector< U, DIM > &rhs) const
 Computes the dot product of this vector with the specified vector. More...
 
constexpr remove_complex_t< T > Length () const
 Computes the length of the vector. More...
 
constexpr T operator[] (std::size_t i) const
 Gets a component of the vector by index. More...
 
constexpr T & operator[] (std::size_t i)
 Gets a mutable reference to the component of the vector by index. More...
 
constexpr remove_complex_t< T > LengthSquared () const
 Gets the square of the length of the vector. More...
 
constexpr BasicVectorNormalise ()
 Normalises the current vector. More...
 
constexpr BasicVector Normalised () const
 Gets a new vector which is the normalised version of this vector. More...
 
ConjugateType Conjugate () const
 Computes the complex conjugate of the vector. More...
 
BasicVectorConjugateOverwrite () const
 Overwrites the vector with its complex conjugate. More...
 
std::size_t size () const
 Gets the number of elements in the vector. More...
 

Related Functions

(Note that these are not member functions.)

template<typename T , typename U , std::size_t DIM>
constexpr BasicVector< std::common_type_t< T, U >, DIM > operator+ (const BasicVector< T, DIM > &lhs, const BasicVector< U, DIM > &rhs)
 Computes the vector resulting from the addition of two vectors. More...
 
template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator+ (BasicVector< T, DIM > lhs, U rhs)
 Computes the vector resulting from adding a scalar to a vector. More...
 
template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator+ (U lhs, BasicVector< T, DIM > rhs)
 Computes the vector resulting from adding a scalar to a vector. More...
 
template<typename T , typename U , std::size_t DIM>
constexpr BasicVector< std::common_type_t< T, U >, DIM > operator- (const BasicVector< T, DIM > &lhs, const BasicVector< U, DIM > &rhs)
 Computes the vector resulting from the subtraction of two vectors. More...
 
template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator- (BasicVector< T, DIM > lhs, U rhs)
 Computes the vector resulting from subtracting a scalar from a vector. More...
 
template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator- (U lhs, const BasicVector< T, DIM > &rhs)
 Computes the vector resulting from subtracting a vector from a scalar. More...
 
template<typename T , typename U , std::size_t DIM>
constexpr BasicVector< std::common_type_t< T, U >, DIM > operator/ (const BasicVector< T, DIM > &lhs, const BasicVector< U, DIM > &rhs)
 Computes the vector resulting from dividing all components of the first vector by the matching component of the second vector (elementwise division) More...
 
template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator/ (BasicVector< T, DIM > lhs, U rhs)
 Computes the vector resulting from dividing all components of the specified vector by a constant. More...
 
template<typename T , typename U , std::size_t DIM>
constexpr BasicVector< std::common_type_t< T, U >, DIM > operator/ (U lhs, const BasicVector< T, DIM > &rhs)
 Computes the vector resulting from dividing a constant by every component of a vector (elementwise division) More...
 
template<typename T , typename U , std::size_t DIM>
constexpr BasicVector< std::common_type_t< T, U >, DIM > operator* (const BasicVector< T, DIM > &lhs, const BasicVector< U, DIM > &rhs)
 Computes the vector resulting from multiplying all components of the first vector by the matching component of the second vector (elementwise multiplication) More...
 
template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator* (BasicVector< T, DIM > lhs, U rhs)
 Computes the vector resulting from (right) multiplying all components of the specified vector by a constant. More...
 
template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator* (U lhs, BasicVector< T, DIM > rhs)
 Computes the vector resulting from (left) multiplying all components of the specified vector by a constant. More...
 
template<typename T , std::size_t DIM>
std::istreamoperator>> (std::istream &is, BasicVector< T, DIM > &vec)
 Reads a vector from an input stream. More...
 
template<typename T , std::size_t DIM>
std::ostreamoperator<< (std::ostream &os, const BasicVector< T, DIM > &vec)
 Writes a vector to an output stream. More...
 
template<typename T , typename U , std::size_t DIM>
constexpr bool operator== (const BasicVector< T, DIM > &lhs, const BasicVector< U, DIM > &rhs)
 Compares two vectors for equality - all components are equal. More...
 
template<typename T , typename U , std::size_t DIM>
constexpr bool operator!= (const BasicVector< T, DIM > &lhs, const BasicVector< U, DIM > &rhs)
 Compares two vectors for inequality - any components are different. More...
 
template<typename U , typename T >
constexpr bool operator== (const BasicVector< T, 1 > &lhs, U rhs)
 Compares 1D vector with a scalar. More...
 
template<typename U , typename T >
constexpr bool operator== (U lhs, const BasicVector< T, 1 > &rhs)
 Compares 1D vector with a scalar. More...
 
template<typename U , typename T >
constexpr bool operator!= (const BasicVector< T, 1 > &lhs, U rhs)
 Compares 1D vector with a scalar for inequality. More...
 
template<typename U , typename T >
constexpr bool operator!= (U lhs, const BasicVector< T, 1 > &rhs)
 Compares 1D vector with a scalar for inequality. More...
 
template<typename T , std::size_t DIM>
constexpr BasicVector< T, DIM >::ConjugateType Conjugate (const BasicVector< T, DIM > &vec)
 Computes the complex conjugate of a vector. More...
 
template<typename T , std::size_t DIM, typename = std::enable_if_t<is_complex_v<T>>>
constexpr BasicVector< T, DIM >::ConjugateType Conjugate (BasicVector< T, DIM > &&vec)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 

Detailed Description

template<typename T, std::size_t DIM>
struct ptems::BasicVector< T, DIM >

Vector representing a point in DIM-dimensional space.

Template Parameters
TThe type of the vector component
DIMThe dimension of the space

Member Typedef Documentation

◆ ConjugateType

template<typename T , std::size_t DIM>
using ptems::BasicVector< T, DIM >::ConjugateType = BasicVector<typename std::conditional_t<is_complex_v<T>, T, std::complex<T> >,DIM>

The type of the conjugate of the vector.

Will either be the same type if T is complex, otherwise a vector of std::complex<T>.

Constructor & Destructor Documentation

◆ BasicVector() [1/4]

template<typename T , std::size_t DIM>
constexpr ptems::BasicVector< T, DIM >::BasicVector ( )
inlineconstexpr

Construct a zero vector.

◆ BasicVector() [2/4]

template<typename T , std::size_t DIM>
constexpr ptems::BasicVector< T, DIM >::BasicVector ( value)
inlineexplicitconstexpr

Construct a vector with all components equal to the specified value.

Parameters
valueValue to fill in each component of the vector

◆ BasicVector() [3/4]

template<typename T , std::size_t DIM>
template<typename... F, typename = std::enable_if_t<sizeof...(F) == DIM>>
constexpr ptems::BasicVector< T, DIM >::BasicVector ( F...  pt)
inlineconstexpr

Construct a vector for the specified point.

Template Parameters
FAny type explicitly convertible to T
Parameters
ptThe components of the vector, must be exactly DIM components

◆ BasicVector() [4/4]

template<typename T , std::size_t DIM>
template<typename U >
constexpr ptems::BasicVector< T, DIM >::BasicVector ( const BasicVector< U, DIM >  rhs)
inlineconstexpr

Construct a vector by copying the specified vector.

Template Parameters
UType of the vector to copy
Parameters
rhsVector to copy

Member Function Documentation

◆ Conjugate()

template<typename T , std::size_t DIM>
ConjugateType ptems::BasicVector< T, DIM >::Conjugate ( ) const
inline

Computes the complex conjugate of the vector.

Returns
The complex conjugate of the vector

◆ ConjugateOverwrite()

template<typename T , std::size_t DIM>
BasicVector& ptems::BasicVector< T, DIM >::ConjugateOverwrite ( ) const
inline

Overwrites the vector with its complex conjugate.

Returns
this

◆ Dot()

template<typename T , std::size_t DIM>
template<typename U >
constexpr std::common_type_t<T,U> ptems::BasicVector< T, DIM >::Dot ( const BasicVector< U, DIM > &  rhs) const
inlineconstexpr

Computes the dot product of this vector with the specified vector.

Template Parameters
UType of the components of the vector to dot product with
Parameters
rhsVector to dot product with this vector
Returns
The result of the dot product

◆ Length()

template<typename T , std::size_t DIM>
constexpr remove_complex_t<T> ptems::BasicVector< T, DIM >::Length ( ) const
inlineconstexpr

Computes the length of the vector.

Returns
The vector length.

◆ LengthSquared()

template<typename T , std::size_t DIM>
constexpr remove_complex_t<T> ptems::BasicVector< T, DIM >::LengthSquared ( ) const
inlineconstexpr

Gets the square of the length of the vector.

Returns
The length squared.

◆ Normalise()

template<typename T , std::size_t DIM>
constexpr BasicVector& ptems::BasicVector< T, DIM >::Normalise ( )
inlineconstexpr

Normalises the current vector.

Returns
Reference to this vector after normalisation.

◆ Normalised()

template<typename T , std::size_t DIM>
constexpr BasicVector ptems::BasicVector< T, DIM >::Normalised ( ) const
inlineconstexpr

Gets a new vector which is the normalised version of this vector.

Returns
The normalised vector

◆ operator*=() [1/2]

template<typename T , std::size_t DIM>
template<typename U >
constexpr BasicVector& ptems::BasicVector< T, DIM >::operator*= ( const BasicVector< U, DIM > &  rhs)
inlineconstexpr

Performs elementwise multiplication of all components of this vector by the other vector.

Template Parameters
UType of the components of the vector to multiply by
Parameters
rhsVector to multiply by elementwise
Returns
Reference to this vector after multiplying by rhs

◆ operator*=() [2/2]

template<typename T , std::size_t DIM>
template<typename U >
constexpr BasicVector& ptems::BasicVector< T, DIM >::operator*= ( rhs)
inlineconstexpr

Multiplies all components of this vector by a constant.

Template Parameters
UType of right hand side
Parameters
rhsConstant to multiple vector by
Returns
Reference to this vector after multiplying by rhs

◆ operator+=() [1/2]

template<typename T , std::size_t DIM>
template<typename U >
constexpr BasicVector& ptems::BasicVector< T, DIM >::operator+= ( const BasicVector< U, DIM > &  rhs)
inlineconstexpr

Adds another vector to this vector.

Template Parameters
UType of the components of the vector to add
Parameters
rhsVector to add
Returns
Reference to this vector after adding rhs

◆ operator+=() [2/2]

template<typename T , std::size_t DIM>
constexpr BasicVector& ptems::BasicVector< T, DIM >::operator+= ( rhs)
inlineconstexpr

Adds a constant to every component to this vector.

Parameters
rhsConstant to add
Returns
Reference to this vector after adding rhs

◆ operator-()

template<typename T , std::size_t DIM>
constexpr BasicVector ptems::BasicVector< T, DIM >::operator- ( ) const
inlineconstexpr

Returns the negated vector.

Parameters
rhsVector to negate
Returns
The negated vector

◆ operator-=() [1/2]

template<typename T , std::size_t DIM>
template<typename U >
constexpr BasicVector& ptems::BasicVector< T, DIM >::operator-= ( const BasicVector< U, DIM > &  rhs)
inlineconstexpr

Subtracts another vector to this vector.

Template Parameters
UType of the components of the vector to subtract
Parameters
rhsVector to subtract
Returns
Reference to this vector after subtracting rhs

◆ operator-=() [2/2]

template<typename T , std::size_t DIM>
constexpr BasicVector& ptems::BasicVector< T, DIM >::operator-= ( rhs)
inlineconstexpr

Subtracts constant from every component to this vector.

Parameters
rhsConstant to subtract
Returns
Reference to this vector after subtracting rhs

◆ operator/=() [1/2]

template<typename T , std::size_t DIM>
template<typename U >
constexpr BasicVector& ptems::BasicVector< T, DIM >::operator/= ( const BasicVector< U, DIM > &  rhs)
inlineconstexpr

Performs elementwise division of all components of this vector by the other vector.

Template Parameters
UType of the components of the vector to divide by
Parameters
rhsVector to divide by elementwise
Returns
Reference to this vector after dividing by rhs

◆ operator/=() [2/2]

template<typename T , std::size_t DIM>
template<typename U >
constexpr BasicVector& ptems::BasicVector< T, DIM >::operator/= ( rhs)
inlineconstexpr

Divides all components of this vector by a constant.

Template Parameters
UType of right hand side
Parameters
rhsConstant to divide vector by
Returns
Reference to this vector after dividing by rhs

◆ operator=() [1/2]

template<typename T , std::size_t DIM>
template<typename U >
constexpr BasicVector& ptems::BasicVector< T, DIM >::operator= ( const BasicVector< U, DIM >  rhs)
inlineconstexpr

Copy the specified vector to this.

Template Parameters
UType of the vector to copy
Parameters
rhsVector to copy

◆ operator=() [2/2]

template<typename T , std::size_t DIM>
constexpr BasicVector& ptems::BasicVector< T, DIM >::operator= ( rhs)
inlineconstexpr

Set all components tof vector equal to a constants.

Parameters
rhsScalar to set vector to

◆ operator[]() [1/2]

template<typename T , std::size_t DIM>
constexpr T& ptems::BasicVector< T, DIM >::operator[] ( std::size_t  i)
inlineconstexpr

Gets a mutable reference to the component of the vector by index.

Parameters
iThe index of the component of the vector to get (must be less than DIM).
Exceptions
std::out_of_rangeIf i is not less than DIM.
Returns
Mutable reference to the value at the specified component

◆ operator[]() [2/2]

template<typename T , std::size_t DIM>
constexpr T ptems::BasicVector< T, DIM >::operator[] ( std::size_t  i) const
inlineconstexpr

Gets a component of the vector by index.

Parameters
iThe index of the component of the vector to get (must be less than DIM).
Exceptions
std::out_of_rangeIf i is not less than DIM.
Returns
Value at the specified component

◆ size()

template<typename T , std::size_t DIM>
std::size_t ptems::BasicVector< T, DIM >::size ( ) const
inline

Gets the number of elements in the vector.

Returns
DIM

Friends And Related Function Documentation

◆ Conjugate() [1/2]

template<typename T , std::size_t DIM, typename = std::enable_if_t<is_complex_v<T>>>
constexpr BasicVector< T, DIM >::ConjugateType Conjugate ( BasicVector< T, DIM > &&  vec)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ Conjugate() [2/2]

template<typename T , std::size_t DIM>
constexpr BasicVector< T, DIM >::ConjugateType Conjugate ( const BasicVector< T, DIM > &  vec)
related

Computes the complex conjugate of a vector.

Template Parameters
TType of the components of the vector
Parameters
vecThe vector to conjugate
Returns
The conjugated vector

◆ operator!=() [1/3]

template<typename U , typename T >
constexpr bool operator!= ( const BasicVector< T, 1 > &  lhs,
rhs 
)
related

Compares 1D vector with a scalar for inequality.

Template Parameters
TType of the components of the left hand vector
UType of the scalar
Parameters
lhsThe left hand side vector to compare
rhsThe right hand side scalar to compare
Returns
false if the only vector component is equal to the scalar value, true otherwise

◆ operator!=() [2/3]

template<typename T , typename U , std::size_t DIM>
constexpr bool operator!= ( const BasicVector< T, DIM > &  lhs,
const BasicVector< U, DIM > &  rhs 
)
related

Compares two vectors for inequality - any components are different.

Template Parameters
TType of the components of the left hand vector
UType of the components of the right hand vector
DIMThe dimension of the vectors to compare.
Parameters
lhsThe left hand side vector to compare
rhsThe right hand side vector to compare
Returns
false if all components are equal, true otherwise

◆ operator!=() [3/3]

template<typename U , typename T >
constexpr bool operator!= ( lhs,
const BasicVector< T, 1 > &  rhs 
)
related

Compares 1D vector with a scalar for inequality.

Template Parameters
TType of the components of the right hand vector
UType of the scalar
Parameters
lhsThe left hand side scalar to compare
rhsThe right hand side vector to compare
Returns
false if the only vector component is equal to the scalar value, true otherwise

◆ operator*() [1/3]

template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator* ( BasicVector< T, DIM >  lhs,
rhs 
)
related

Computes the vector resulting from (right) multiplying all components of the specified vector by a constant.

Template Parameters
TType of the components of the left hand vector
UType of the scalar
DIMThe dimension of the vector
Parameters
lhsThe vector to multiply all components by a scalar
rhsThe scalar to multiply the vector by
Returns
The vector resulting from multiplying lhs by rhs

◆ operator*() [2/3]

template<typename T , typename U , std::size_t DIM>
constexpr BasicVector< std::common_type_t< T, U >, DIM > operator* ( const BasicVector< T, DIM > &  lhs,
const BasicVector< U, DIM > &  rhs 
)
related

Computes the vector resulting from multiplying all components of the first vector by the matching component of the second vector (elementwise multiplication)

Template Parameters
TType of the components of the left hand vector
UType of the components of the right hand vector
DIMThe dimension of the vector
Parameters
lhsThe vector to multiply all components
rhsThe vector to multiply by
Returns
The vector resulting from multiplying lhs by rhs

◆ operator*() [3/3]

template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator* ( lhs,
BasicVector< T, DIM >  rhs 
)
related

Computes the vector resulting from (left) multiplying all components of the specified vector by a constant.

Template Parameters
TType of the components of the right hand vector
UType of the scalar
DIMThe dimension of the vector
Parameters
lhsThe scalar to multiply the vector by
rhsThe vector to multiply all components by a scalar
Returns
The vector resulting from multiplying rhs by lhs

◆ operator+() [1/3]

template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator+ ( BasicVector< T, DIM >  lhs,
rhs 
)
related

Computes the vector resulting from adding a scalar to a vector.

Template Parameters
TType of the components of the left hand vector
UType of the scalar
DIMThe dimension of the vectors
Parameters
lhsThe left hand side vector of the addition
rhsThe right hand side scalar of the addition
Returns
The vector resulting from adding lhs and rhs

◆ operator+() [2/3]

template<typename T , typename U , std::size_t DIM>
constexpr BasicVector< std::common_type_t< T, U >, DIM > operator+ ( const BasicVector< T, DIM > &  lhs,
const BasicVector< U, DIM > &  rhs 
)
related

Computes the vector resulting from the addition of two vectors.

Template Parameters
TType of the components of the left hand vector
UType of the components of the right hand vector
DIMThe dimension of the vectors
Parameters
lhsThe left hand side vector of the addition
rhsThe right hand side of the addition
Returns
The vector resulting from adding lhs and rhs

◆ operator+() [3/3]

template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator+ ( lhs,
BasicVector< T, DIM >  rhs 
)
related

Computes the vector resulting from adding a scalar to a vector.

Template Parameters
UType of the scalar
TType of the components of the right hand vector
DIMThe dimension of the vectors
Parameters
lhsThe left hand side scalar of the addition
rhsThe right hand side vector of the addition
Returns
The vector resulting from adding lhs and rhs

◆ operator-() [1/3]

template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator- ( BasicVector< T, DIM >  lhs,
rhs 
)
related

Computes the vector resulting from subtracting a scalar from a vector.

Template Parameters
TType of the components of the left hand vector
UType of the scalar
DIMThe dimension of the vectors
Parameters
lhsThe vector to subtract from
rhsThe scalar to subtract
Returns
The vector resulting from subtracting rhs from lhs

◆ operator-() [2/3]

template<typename T , typename U , std::size_t DIM>
constexpr BasicVector< std::common_type_t< T, U >, DIM > operator- ( const BasicVector< T, DIM > &  lhs,
const BasicVector< U, DIM > &  rhs 
)
related

Computes the vector resulting from the subtraction of two vectors.

Template Parameters
TType of the components of the left hand vector
UType of the components of the right hand vector
DIMThe dimension of the vectors
Parameters
lhsThe vector to subtract from
rhsThe vector to subtract
Returns
The vector resulting from subtracting rhs from lhs

◆ operator-() [3/3]

template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator- ( lhs,
const BasicVector< T, DIM > &  rhs 
)
related

Computes the vector resulting from subtracting a vector from a scalar.

Template Parameters
TType of the components of the right hand vector
UType of the scalar
DIMThe dimension of the vectors
Parameters
lhsThe scalar to subtract from
rhsThe vector to subtract
Returns
The vector resulting from subtracting rhs from lhs

◆ operator/() [1/3]

template<typename U , typename T , std::size_t DIM>
constexpr BasicVector< T, DIM > operator/ ( BasicVector< T, DIM >  lhs,
rhs 
)
related

Computes the vector resulting from dividing all components of the specified vector by a constant.

Template Parameters
TType of the components of the left hand vector
UType of the scalar
DIMThe dimension of the vector
Parameters
lhsThe vector to divide all components by a scalar
rhsThe scalar to divide the vector by
Returns
The vector resulting from dividing lhs by rhs

◆ operator/() [2/3]

template<typename T , typename U , std::size_t DIM>
constexpr BasicVector< std::common_type_t< T, U >, DIM > operator/ ( const BasicVector< T, DIM > &  lhs,
const BasicVector< U, DIM > &  rhs 
)
related

Computes the vector resulting from dividing all components of the first vector by the matching component of the second vector (elementwise division)

Template Parameters
TType of the components of the left hand vector
UType of the components of the right hand vector
DIMThe dimension of the vector
Parameters
lhsThe vector to divide all components of
rhsThe vector to divide by
Returns
The vector resulting from dividing lhs by rhs

◆ operator/() [3/3]

template<typename T , typename U , std::size_t DIM>
constexpr BasicVector< std::common_type_t< T, U >, DIM > operator/ ( lhs,
const BasicVector< T, DIM > &  rhs 
)
related

Computes the vector resulting from dividing a constant by every component of a vector (elementwise division)

Template Parameters
TType of the components of the right hand vector
UType of the scalar
DIMThe dimension of the vector
Parameters
lhsThe scalar to divide by all components of a vector
rhsThe vector to divide the constant by component-wise
Returns
The vector resulting from dividing lhs by rhs

◆ operator<<()

template<typename T , std::size_t DIM>
std::ostream & operator<< ( std::ostream os,
const BasicVector< T, DIM > &  vec 
)
related

Writes a vector to an output stream.

A vector will be written as a comma-separated list of DIM floating point values.

Template Parameters
TType of the components of the vector
DIMThe dimension of the vector to write.
Parameters
osThe stream to write the vector to
vecThe vector to write
Returns
os

◆ operator==() [1/3]

template<typename U , typename T >
constexpr bool operator== ( const BasicVector< T, 1 > &  lhs,
rhs 
)
related

Compares 1D vector with a scalar.

Template Parameters
TType of the components of the left hand vector
UType of the scalar
Parameters
lhsThe left hand side vector to compare
rhsThe right hand side scalar to compare
Returns
true if the only vector component is equal to the scalar value, false otherwise

◆ operator==() [2/3]

template<typename T , typename U , std::size_t DIM>
constexpr bool operator== ( const BasicVector< T, DIM > &  lhs,
const BasicVector< U, DIM > &  rhs 
)
related

Compares two vectors for equality - all components are equal.

Template Parameters
TType of the components of the left hand vector
UType of the components of the right hand vector
DIMThe dimension of the vectors to compare.
Parameters
lhsThe left hand side vector to compare
rhsThe right hand side vector to compare
Returns
true if all components are equal, false otherwise

◆ operator==() [3/3]

template<typename U , typename T >
constexpr bool operator== ( lhs,
const BasicVector< T, 1 > &  rhs 
)
related

Compares 1D vector with a scalar.

Template Parameters
TType of the components of the right hand vector
UType of the scalar
Parameters
lhsThe left hand side scalar to compare
rhsThe right hand side vector to compare
Returns
true if the only vector component is equal to the scalar value, false otherwise

◆ operator>>()

template<typename T , std::size_t DIM>
std::istream & operator>> ( std::istream is,
BasicVector< T, DIM > &  vec 
)
related

Reads a vector from an input stream.

A vector should be a comma-separated list of DIM floating point values.

Template Parameters
TType of the components of the vector
DIMThe dimension of the vector to read.
Parameters
isThe stream to read the vector from
vecThe vector to read into
Returns
is

The documentation for this struct was generated from the following file: