libcamera  v0.4.0
Supporting cameras in Linux since 2019
Public Member Functions | List of all members
libcamera::ipa::Vector< T, Rows > Class Template Reference

Vector class. More...

Public Member Functions

constexpr Vector ()=default
 Construct an uninitialized vector.
 
constexpr Vector (T scalar)
 Construct a vector filled with a scalar value. More...
 
constexpr Vector (const std::array< T, Rows > &data)
 Construct vector from supplied data. More...
 
const T & operator[] (size_t i) const
 Index to an element in the vector. More...
 
T & operator[] (size_t i)
 Index to an element in the vector. More...
 
constexpr Vector< T, Rows > operator- () const
 Negate a Vector by negating both all of its coordinates. More...
 
constexpr Vector operator+ (const Vector &other) const
 Calculate the sum of this vector and other element-wise. More...
 
constexpr Vector operator+ (T scalar) const
 Calculate the sum of this vector and scalar element-wise. More...
 
constexpr Vector operator- (const Vector &other) const
 Calculate the difference of this vector and other element-wise. More...
 
constexpr Vector operator- (T scalar) const
 Calculate the difference of this vector and scalar element-wise. More...
 
constexpr Vector operator* (const Vector &other) const
 Calculate the product of this vector and other element-wise. More...
 
constexpr Vector operator* (T scalar) const
 Calculate the product of this vector and scalar element-wise. More...
 
constexpr Vector operator/ (const Vector &other) const
 Calculate the quotient of this vector and other element-wise. More...
 
constexpr Vector operator/ (T scalar) const
 Calculate the quotient of this vector and scalar element-wise. More...
 
Vectoroperator+= (const Vector &other)
 Add other element-wise to this vector. More...
 
Vectoroperator+= (T scalar)
 Add scalar element-wise to this vector. More...
 
Vectoroperator-= (const Vector &other)
 Subtract other element-wise from this vector. More...
 
Vectoroperator-= (T scalar)
 Subtract scalar element-wise from this vector. More...
 
Vectoroperator*= (const Vector &other)
 Multiply this vector by other element-wise. More...
 
Vectoroperator*= (T scalar)
 Multiply this vector by scalar element-wise. More...
 
Vectoroperator/= (const Vector &other)
 Divide this vector by other element-wise. More...
 
Vectoroperator/= (T scalar)
 Divide this vector by scalar element-wise. More...
 
constexpr Vector min (const Vector &other) const
 Calculate the minimum of this vector and other element-wise. More...
 
constexpr Vector min (T scalar) const
 Calculate the minimum of this vector and scalar element-wise. More...
 
constexpr Vector max (const Vector &other) const
 Calculate the maximum of this vector and other element-wise. More...
 
constexpr Vector max (T scalar) const
 Calculate the maximum of this vector and scalar element-wise. More...
 
constexpr T dot (const Vector< T, Rows > &other) const
 Compute the dot product. More...
 
constexpr const T & x () const
 Convenience function to access the first element of the vector. More...
 
constexpr const T & y () const
 Convenience function to access the second element of the vector. More...
 
constexpr const T & z () const
 Convenience function to access the third element of the vector. More...
 
constexpr T & x ()
 Convenience function to access the first element of the vector. More...
 
constexpr T & y ()
 Convenience function to access the second element of the vector. More...
 
constexpr T & z ()
 Convenience function to access the third element of the vector. More...
 
constexpr const T & r () const
 Convenience function to access the first element of the vector. More...
 
constexpr const T & g () const
 Convenience function to access the second element of the vector. More...
 
constexpr const T & b () const
 Convenience function to access the third element of the vector. More...
 
constexpr T & r ()
 Convenience function to access the first element of the vector. More...
 
constexpr T & g ()
 Convenience function to access the second element of the vector. More...
 
constexpr T & b ()
 Convenience function to access the third element of the vector. More...
 
constexpr double length2 () const
 Get the squared length of the vector. More...
 
constexpr double length () const
 Get the length of the vector. More...
 
template<typename R = T>
constexpr R sum () const
 Calculate the sum of all the vector elements. More...
 

Detailed Description

template<typename T, unsigned int Rows>
class libcamera::ipa::Vector< T, Rows >

Vector class.

Template Parameters
TType of numerical values to be stored in the vector
RowsNumber of dimension of the vector (= number of elements)

Constructor & Destructor Documentation

◆ Vector() [1/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::Vector ( scalar)
inlineexplicit

Construct a vector filled with a scalar value.

Parameters
[in]scalarThe scalar value

◆ Vector() [2/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::Vector ( const std::array< T, Rows > &  data)
inline

Construct vector from supplied data.

Parameters
dataData from which to construct a vector

The size of data must be equal to the dimension size Rows of the vector.

Member Function Documentation

◆ b() [1/2]

template<typename T, unsigned int Rows>
constexpr const T & libcamera::ipa::Vector< T, Rows >::b ( ) const
inline

Convenience function to access the third element of the vector.

Returns
The third element of the vector

◆ b() [2/2]

template<typename T, unsigned int Rows>
constexpr T & libcamera::ipa::Vector< T, Rows >::b ( )
inline

Convenience function to access the third element of the vector.

Returns
The third element of the vector

◆ dot()

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::dot ( const Vector< T, Rows > &  other) const
inline

Compute the dot product.

Parameters
[in]otherThe other vector
Returns
The dot product of the two vectors

◆ g() [1/2]

template<typename T, unsigned int Rows>
constexpr const T & libcamera::ipa::Vector< T, Rows >::g ( ) const
inline

Convenience function to access the second element of the vector.

Returns
The second element of the vector

◆ g() [2/2]

template<typename T, unsigned int Rows>
constexpr T & libcamera::ipa::Vector< T, Rows >::g ( )
inline

Convenience function to access the second element of the vector.

Returns
The second element of the vector

◆ length()

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::length ( ) const
inline

Get the length of the vector.

Returns
The length of the vector

◆ length2()

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::length2 ( ) const
inline

Get the squared length of the vector.

Returns
The squared length of the vector

◆ max() [1/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::max ( const Vector< T, Rows > &  other) const
inline

Calculate the maximum of this vector and other element-wise.

Parameters
[in]otherThe other vector
Returns
The element-wise maximum of this vector and other

◆ max() [2/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::max ( scalar) const
inline

Calculate the maximum of this vector and scalar element-wise.

Parameters
[in]scalarThe scalar
Returns
The element-wise maximum of this vector and scalar

◆ min() [1/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::min ( const Vector< T, Rows > &  other) const
inline

Calculate the minimum of this vector and other element-wise.

Parameters
[in]otherThe other vector
Returns
The element-wise minimum of this vector and other

◆ min() [2/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::min ( scalar) const
inline

Calculate the minimum of this vector and scalar element-wise.

Parameters
[in]scalarThe scalar
Returns
The element-wise minimum of this vector and scalar

◆ operator*() [1/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator* ( const Vector< T, Rows > &  other) const
inline

Calculate the product of this vector and other element-wise.

Parameters
[in]otherThe other vector
Returns
The element-wise product of this vector and other

◆ operator*() [2/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator* ( scalar) const
inline

Calculate the product of this vector and scalar element-wise.

Parameters
[in]scalarThe scalar
Returns
The element-wise product of this vector and scalar

◆ operator*=() [1/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator*= ( const Vector< T, Rows > &  other)
inline

Multiply this vector by other element-wise.

Parameters
[in]otherThe other vector
Returns
This vector

◆ operator*=() [2/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator*= ( scalar)
inline

Multiply this vector by scalar element-wise.

Parameters
[in]scalarThe scalar
Returns
This vector

◆ operator+() [1/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator+ ( const Vector< T, Rows > &  other) const
inline

Calculate the sum of this vector and other element-wise.

Parameters
[in]otherThe other vector
Returns
The element-wise sum of this vector and other

◆ operator+() [2/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator+ ( scalar) const
inline

Calculate the sum of this vector and scalar element-wise.

Parameters
[in]scalarThe scalar
Returns
The element-wise sum of this vector and other

◆ operator+=() [1/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator+= ( const Vector< T, Rows > &  other)
inline

Add other element-wise to this vector.

Parameters
[in]otherThe other vector
Returns
This vector

◆ operator+=() [2/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator+= ( scalar)
inline

Add scalar element-wise to this vector.

Parameters
[in]scalarThe scalar
Returns
This vector

◆ operator-() [1/3]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator- ( ) const
inline

Negate a Vector by negating both all of its coordinates.

Returns
The negated vector

◆ operator-() [2/3]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator- ( const Vector< T, Rows > &  other) const
inline

Calculate the difference of this vector and other element-wise.

Parameters
[in]otherThe other vector
Returns
The element-wise subtraction of other from this vector

◆ operator-() [3/3]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator- ( scalar) const
inline

Calculate the difference of this vector and scalar element-wise.

Parameters
[in]scalarThe scalar
Returns
The element-wise subtraction of scalar from this vector

◆ operator-=() [1/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator-= ( const Vector< T, Rows > &  other)
inline

Subtract other element-wise from this vector.

Parameters
[in]otherThe other vector
Returns
This vector

◆ operator-=() [2/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator-= ( scalar)
inline

Subtract scalar element-wise from this vector.

Parameters
[in]scalarThe scalar
Returns
This vector

◆ operator/() [1/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator/ ( const Vector< T, Rows > &  other) const
inline

Calculate the quotient of this vector and other element-wise.

Parameters
[in]otherThe other vector
Returns
The element-wise division of this vector by other

◆ operator/() [2/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator/ ( scalar) const
inline

Calculate the quotient of this vector and scalar element-wise.

Parameters
[in]scalarThe scalar
Returns
The element-wise division of this vector by scalar

◆ operator/=() [1/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator/= ( const Vector< T, Rows > &  other)
inline

Divide this vector by other element-wise.

Parameters
[in]otherThe other vector
Returns
This vector

◆ operator/=() [2/2]

template<typename T, unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator/= ( scalar)
inline

Divide this vector by scalar element-wise.

Parameters
[in]scalarThe scalar
Returns
This vector

◆ operator[]() [1/2]

template<typename T, unsigned int Rows>
T libcamera::ipa::Vector< T, Rows >::operator[] ( size_t  i) const
inline

Index to an element in the vector.

Parameters
iIndex of element to retrieve
Returns
Element at index i from the vector

◆ operator[]() [2/2]

template<typename T, unsigned int Rows>
T & libcamera::ipa::Vector< T, Rows >::operator[] ( size_t  i)
inline

Index to an element in the vector.

Parameters
iIndex of element to retrieve
Returns
Element at index i from the vector

◆ r() [1/2]

template<typename T, unsigned int Rows>
constexpr const T & libcamera::ipa::Vector< T, Rows >::r ( ) const
inline

Convenience function to access the first element of the vector.

Returns
The first element of the vector

◆ r() [2/2]

template<typename T, unsigned int Rows>
constexpr T & libcamera::ipa::Vector< T, Rows >::r ( )
inline

Convenience function to access the first element of the vector.

Returns
The first element of the vector

◆ sum()

template<typename T, unsigned int Rows>
template<typename R = T>
libcamera::ipa::Vector< T, Rows >::sum ( ) const
inline

Calculate the sum of all the vector elements.

Template Parameters
RThe type of the sum

The type R of the sum defaults to the type T of the elements, but can be set explicitly to use a different type in case the type T would risk overflowing.

Returns
The sum of all the vector elements

◆ x() [1/2]

template<typename T, unsigned int Rows>
constexpr const T & libcamera::ipa::Vector< T, Rows >::x ( ) const
inline

Convenience function to access the first element of the vector.

Returns
The first element of the vector

◆ x() [2/2]

template<typename T, unsigned int Rows>
constexpr T & libcamera::ipa::Vector< T, Rows >::x ( )
inline

Convenience function to access the first element of the vector.

Returns
The first element of the vector

◆ y() [1/2]

template<typename T, unsigned int Rows>
constexpr const T & libcamera::ipa::Vector< T, Rows >::y ( ) const
inline

Convenience function to access the second element of the vector.

Returns
The second element of the vector

◆ y() [2/2]

template<typename T, unsigned int Rows>
constexpr T & libcamera::ipa::Vector< T, Rows >::y ( )
inline

Convenience function to access the second element of the vector.

Returns
The second element of the vector

◆ z() [1/2]

template<typename T, unsigned int Rows>
constexpr const T & libcamera::ipa::Vector< T, Rows >::z ( ) const
inline

Convenience function to access the third element of the vector.

Returns
The third element of the vector

◆ z() [2/2]

template<typename T, unsigned int Rows>
constexpr T & libcamera::ipa::Vector< T, Rows >::z ( )
inline

Convenience function to access the third element of the vector.

Returns
The third element of the vector

The documentation for this class was generated from the following files: