public

Inheritance Graph

graph BT
	_VecN
	click _VecN "classGeometry_1_1__VecN"

Description

n-dimensional vector.

Author: Ralf Petring, Benjamin Eikel

Date: 2011-02-24

Classes

   
class Geometry::_VecN::Comparator
struct Geometry::_VecN::GetAbs
struct Geometry::_VecN::GetAvg
struct Geometry::_VecN::GetMax
struct Geometry::_VecN::GetMin
struct Geometry::_VecN::Sum

Serialization

 
 
 

Public Types

   
   
typedef Type value_t
   
typedef FloatType float_t
   
typedef _VecN < value_t , float_t > vecN_t

Public Static Attributes

   
   
const uint32_t MAXIMUM_NORM
   
const uint32_t MANHATTAN_NORM
   
const uint32_t EUCLIDEAN_NORM

Public Functions

   
   
  _VecN(const size_t dimensions, value_t value)
   
  _VecN(const size_t dimensions, const value_t *const values)
template< typename _InputIterator >  
  _VecN(_InputIterator _first, _InputIterator _end)
   
  ~_VecN()
destructor
   
  _VecN(const _VecN & void)
copy constructor
   
  _VecN( _VecN && void)
move constructor
   
_VecN & operator=(const _VecN & void)
assignment operator
   
_VecN & operator=( _VecN && void)
move assignment operator
   
value_t * data()
   
const value_t * data() const
   
std::size_t size() const
   
void set(const _VecN & other)
   
void set(const value_t *const values)
   
void setAll(const value_t & value)
   
value_t & operator[](size_t x)
   
const value_t & operator[](size_t x) const
   
vecN_t::const_iterator begin() const
   
vecN_t::iterator begin()
   
vecN_t::const_iterator end() const
   
vecN_t::iterator end()
   
_VecN & operator=(const value_t & constant)
   
_VecN & operator+=(const _VecN & _other)
   
_VecN & operator+=(const value_t & constant)
   
_VecN & operator-=(const _VecN & _other)
   
_VecN & operator-=(const value_t & constant)
   
_VecN & operator*=(const _VecN & _other)
   
_VecN & operator*=(const float_t & constant)
   
_VecN & operator/=(const _VecN & _other)
   
_VecN & operator/=(const float_t & constant)
   
const _VecN operator*(const _VecN & _other) const
   
const _VecN operator*(const float_t & constant) const
   
const _VecN operator/(const _VecN & _other) const
   
const _VecN operator/(const float_t & constant) const
   
const _VecN operator+(const _VecN & _other) const
   
const _VecN operator+(const value_t & constant) const
   
const _VecN operator-(const _VecN & _other) const
   
const _VecN operator-(const value_t & constant) const
   
const _VecN operator-() const
   
_VecN getAbs() const
   
_VecN & abs()
   
value_t max() const
   
value_t min() const
   
float_t avg() const
   
float_t length(uint32_t norm) const

Public Static Functions

   
   
_VecN pairwiseMax(const _VecN & vecA, const _VecN & vecB)
   
_VecN pairwiseMin(const _VecN & vecA, const _VecN & vecB)
   
_VecN pairwiseAvg(const _VecN & vecA, const _VecN & vecB)

Documentation

typedef
Geometry::_VecN::value_t

public
 
 
typedef Type value_t

Defined in Geometry/VecN.h:35


typedef
Geometry::_VecN::float_t

public
 
 
typedef FloatType float_t

Defined in Geometry/VecN.h:36


typedef
Geometry::_VecN::vecN_t

public
 
 
typedef _VecN < value_t , float_t > vecN_t

Defined in Geometry/VecN.h:37


variable
Geometry::_VecN::MAXIMUM_NORM

public static
 
 
const uint32_t MAXIMUM_NORM

constant for the MAXIMUM or INFINITY or L-INF norm

Defined in Geometry/VecN.h:473


variable
Geometry::_VecN::MANHATTAN_NORM

public static
 
 
const uint32_t MANHATTAN_NORM

constant for the MANHATTAN or L-1 norm

Defined in Geometry/VecN.h:475


variable
Geometry::_VecN::EUCLIDEAN_NORM

public static
 
 
const uint32_t EUCLIDEAN_NORM

constant for the EUCLIDEAN or L-2 norm

Defined in Geometry/VecN.h:477


function
Geometry::_VecN::_VecN

public inline
     
     
_VecN( const size_t dimensions,
  value_t value
)    

constructor

Parameters

dimensions
the dimension of the vector
value
all components of this vector will be initialized with his value

Returns

a new VecN

Note: the call VecNf(3,0); does not work, because 0 can be interpreted as nullptr pointer so the call gets ambiguous. in this case remove the second parameter (no change as 0 is the default value) or add an explicit cast to value_t.

Defined in Geometry/VecN.h:132


function
Geometry::_VecN::_VecN

public inline
     
     
_VecN( const size_t dimensions,
  const value_t *const values
)    

constructor

Parameters

dimensions
the dimension of the vector
values
an array of initial values

Returns

a new VecN

Note: causes a segmentation fault if the length of values is smaller than the dimension of this

Defined in Geometry/VecN.h:142


function
Geometry::_VecN::_VecN

public inline
     
template< typename _InputIterator >    
_VecN( _InputIterator _first,
  _InputIterator _end
)    

constructor

Parameters

first
end

Returns

a new VecN containing the elements [first, end)

Defined in Geometry/VecN.h:152


function
Geometry::_VecN::~_VecN

public
   
   
~_VecN( )

destructor

Defined in Geometry/VecN.h:157


function
Geometry::_VecN::_VecN

public
     
     
_VecN( const _VecN & void )

copy constructor

Defined in Geometry/VecN.h:160


function
Geometry::_VecN::_VecN

public
     
     
_VecN( _VecN && void )

move constructor

Defined in Geometry/VecN.h:163


function
Geometry::_VecN::operator=

public
     
     
_VecN & operator=( const _VecN & void )

assignment operator

Defined in Geometry/VecN.h:166


function
Geometry::_VecN::operator=

public
     
     
_VecN & operator=( _VecN && void )

move assignment operator

Defined in Geometry/VecN.h:169


function
Geometry::_VecN::data

public inline
   
   
value_t * data( )

Returns

a pointer to the underlying data of this vector

Defined in Geometry/VecN.h:174


function
Geometry::_VecN::data

public const inline
   
   
const value_t * data( ) const

Returns

a pointer to the underlying data of this vector

Defined in Geometry/VecN.h:181


function
Geometry::_VecN::size

public const inline
   
   
std::size_t size( ) const

Returns

the number of components of this vector

Defined in Geometry/VecN.h:188


function
Geometry::_VecN::set

public inline
     
     
void set( const _VecN & other )

copies the values from other to this VecN

Parameters

other

Defined in Geometry/VecN.h:196


function
Geometry::_VecN::set

public inline
     
     
void set( const value_t *const values )

Parameters

values
the values to be set for the components of this VecN

Note: causes a segmentation fault if the length of values is smaller than the dimension of this

Defined in Geometry/VecN.h:204


function
Geometry::_VecN::setAll

public inline
     
     
void setAll( const value_t & value )

sets all components of this to value

Parameters

value

Defined in Geometry/VecN.h:212


function
Geometry::_VecN::operator[]

public inline
     
     
value_t & operator[]( size_t x )

read/write access to the x-th component of this

Exceptions

std::out_of_range
iff x outside [0 .. size-1]

Note: should not be used for iteration because of slow access, use data() instead

Defined in Geometry/VecN.h:221


function
Geometry::_VecN::operator[]

public const inline
     
     
const value_t & operator[]( size_t x ) const

read-only access to the x-th component of this

Exceptions

std::out_of_range
iff x outside [0 .. size-1]

Note: should not be used for iteration because of slow access, use data() instead

Defined in Geometry/VecN.h:230


function
Geometry::_VecN::begin

public const inline
   
   
vecN_t::const_iterator begin( ) const

read-only access to underlying data

Defined in Geometry/VecN.h:237


function
Geometry::_VecN::begin

public inline
   
   
vecN_t::iterator begin( )

read/write access to underlying data

Defined in Geometry/VecN.h:244


function
Geometry::_VecN::end

public const inline
   
   
vecN_t::const_iterator end( ) const

read-only access to underlying data

Defined in Geometry/VecN.h:251


function
Geometry::_VecN::end

public inline
   
   
vecN_t::iterator end( )

read/write access to underlying data

Defined in Geometry/VecN.h:258


function
Geometry::_VecN::operator=

public inline
     
     
_VecN & operator=( const value_t & constant )

vector = constant, component wise

Exceptions

std::range_error
iff other.size != this.size

Defined in Geometry/VecN.h:266


function
Geometry::_VecN::operator+=

public inline
     
     
_VecN & operator+=( const _VecN & _other )

vector += vector, component wise

Exceptions

std::range_error
iff other.size != this.size

Defined in Geometry/VecN.h:275


function
Geometry::_VecN::operator+=

public inline
     
     
_VecN & operator+=( const value_t & constant )

vector += constant, component wise

Defined in Geometry/VecN.h:284


function
Geometry::_VecN::operator-=

public inline
     
     
_VecN & operator-=( const _VecN & _other )

vector -= vector, component wise

Exceptions

std::range_error
iff other.size != this.size

Defined in Geometry/VecN.h:294


function
Geometry::_VecN::operator-=

public inline
     
     
_VecN & operator-=( const value_t & constant )

vector -= constant, component wise

Defined in Geometry/VecN.h:303


function
Geometry::_VecN::operator*=

public inline
     
     
_VecN & operator*=( const _VecN & _other )

vector *= vector, component wise

Exceptions

std::range_error
iff other.size != this.size

Defined in Geometry/VecN.h:313


function
Geometry::_VecN::operator*=

public inline
     
     
_VecN & operator*=( const float_t & constant )

vector *= constant, component wise

Defined in Geometry/VecN.h:322


function
Geometry::_VecN::operator/=

public inline
     
     
_VecN & operator/=( const _VecN & _other )

vector /= vector, component wise

Defined in Geometry/VecN.h:331


function
Geometry::_VecN::operator/=

public inline
     
     
_VecN & operator/=( const float_t & constant )

vector /= constant, component wise

Defined in Geometry/VecN.h:340


function
Geometry::_VecN::operator*

public const inline
     
     
const _VecN operator*( const _VecN & _other ) const

vector * vector, component wise

Exceptions

std::range_error
iff other.size != this.size

Note: this is not a dot product

Defined in Geometry/VecN.h:351


function
Geometry::_VecN::operator*

public const inline
     
     
const _VecN operator*( const float_t & constant ) const

vector * constant, component wise

Defined in Geometry/VecN.h:360


function
Geometry::_VecN::operator/

public const inline
     
     
const _VecN operator/( const _VecN & _other ) const

vector / vector, component wise

Exceptions

std::range_error
iff other.size != this.size

Defined in Geometry/VecN.h:370


function
Geometry::_VecN::operator/

public const inline
     
     
const _VecN operator/( const float_t & constant ) const

vector / constant, component wise

Defined in Geometry/VecN.h:379


function
Geometry::_VecN::operator+

public const inline
     
     
const _VecN operator+( const _VecN & _other ) const

vector + vector, component wise

Exceptions

std::range_error
iff other.size != this.size

Defined in Geometry/VecN.h:389


function
Geometry::_VecN::operator+

public const inline
     
     
const _VecN operator+( const value_t & constant ) const

vector + constant, component wise

Defined in Geometry/VecN.h:398


function
Geometry::_VecN::operator-

public const inline
     
     
const _VecN operator-( const _VecN & _other ) const

vector - vector, component wise

Exceptions

std::range_error
iff other.size != this.size

Defined in Geometry/VecN.h:408


function
Geometry::_VecN::operator-

public const inline
     
     
const _VecN operator-( const value_t & constant ) const

vector - constant, component wise

Defined in Geometry/VecN.h:417


function
Geometry::_VecN::operator-

public const inline
   
   
const _VecN operator-( ) const
  • vector, component wise

Defined in Geometry/VecN.h:426


function
Geometry::_VecN::getAbs

public const inline
   
   
_VecN getAbs( ) const

Returns

a vector containing componentwise the absulute values of this

Defined in Geometry/VecN.h:435


function
Geometry::_VecN::abs

public inline
   
   
_VecN & abs( )

modifies this by taking componentwise the absolute value

Returns

this

Defined in Geometry/VecN.h:443


function
Geometry::_VecN::max

public const inline
   
   
value_t max( ) const

Returns

the maximum over the components of this vector

Note: this is not the maximum norm

Defined in Geometry/VecN.h:452


function
Geometry::_VecN::min

public const inline
   
   
value_t min( ) const

Returns

the minimum over the components of this vector

Defined in Geometry/VecN.h:459


function
Geometry::_VecN::avg

public const inline
   
   
float_t avg( ) const

Returns

the average over the components of this vector

Defined in Geometry/VecN.h:466


function
Geometry::_VecN::length

public const inline
     
     
float_t length( uint32_t norm ) const

Defined in Geometry/VecN.h:479


function
Geometry::_VecN::pairwiseMax

public static inline
     
     
_VecN pairwiseMax( const _VecN & vecA,
  const _VecN & vecB
)    

Exceptions

std::range_error
iff vecA.size != vecB.size

Defined in Geometry/VecN.h:518


function
Geometry::_VecN::pairwiseMin

public static inline
     
     
_VecN pairwiseMin( const _VecN & vecA,
  const _VecN & vecB
)    

Exceptions

std::range_error
iff vecA.size != vecB.size

Defined in Geometry/VecN.h:528


function
Geometry::_VecN::pairwiseAvg

public static inline
     
     
_VecN pairwiseAvg( const _VecN & vecA,
  const _VecN & vecB
)    

Exceptions

std::range_error
iff vecA.size != vecB.size

Defined in Geometry/VecN.h:538