WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
clockwerk::CartesianVector< L > Class Template Reference

Standard vector class derived from Matrix. More...

#include <CartesianVector.hpp>

Inheritance diagram for clockwerk::CartesianVector< L >:

Public Member Functions

 CartesianVector ()
 CartesianVector (floating_point elements)
 Constructor to initialize a matrix with all the same element.
 CartesianVector (const floating_point(&initial)[L])
 CartesianVector (const CartesianVector< L > &initial)
 CartesianVector (const Matrix< L, 1 > &initial)
 CartesianVector (const std::array< floating_point, L > &initial)
 Constructor for vector initialization via array.
 ~CartesianVector ()
floating_point & operator[] (uint32 idx)
 Function to return a vector value.
int set (uint32 idx, floating_point value)
 Setter specific to the vector class.
int get (uint32 idx, floating_point &result) const
 Getter specific to the vector class.
floating_point get (uint32 idx) const
 Getter specific to the vector class.
int16 norm (floating_point &result) const
 Function to take the norm of a vector.
floating_point norm () const
 Function to take the norm of a vector.
int16 normSquared (floating_point &result) const
 Function to take the squared norm of a vector.
floating_point normSquared () const
 Function to take the squared norm of a vector.
int16 unit (CartesianVector< L > &result) const
 Function to return the unitized version of the vector.
int16 unitize ()
 Function to unitize the current vector.
int16 normalize ()
 Function to unitize the current vector.
Public Member Functions inherited from clockwerk::Matrix< L, 1 >
 Matrix ()
 Default constructor to initialize a matrix to all zeroes for ease of use.
 ~Matrix ()
int16 str (char *output, size_t size) const
 Function to dump information on matrix.
int16 fromStr (const char *val)
 Set value of matrix from string in same format as str().
int16 set (uint32 row, uint32 col, const floating_point &value)
 Function to set a single value in the matrix.
int16 get (uint32 row, uint32 col, floating_point &result) const
 Function to get a single value in the matrix.
void setFromArray (const floating_point *start_ptr, bool column_major=false)
 Function to set the values of the matrix row-wise.
void getAsArray (floating_point *start_ptr, bool column_major=false) const
 Function to get the values of the matrix row-wise.
void getCopy (Matrix< R, C > &result) const
 Function to get a copy of the matrix.
Matrix< R, C > & operator= (const Matrix< R, C > &other)
 Equals operator overload for matrix.
floating_point * operator[] (uint32 idx)
 Function to return a matrix row or vector value.
std::pair< uint32, uint32 > size () const
 Function to get the size of the matrix.
void max (floating_point &result, std::pair< uint32, uint32 > &index) const
 Function to return the maximum value in the matrix.
void min (floating_point &result, std::pair< uint32, uint32 > &index) const
 Function to return the minimum value in the matrix.
int16 det (floating_point &result) const
 Function to return the determinant of the matrix.
int16 chol (Matrix< R, C > &retval) const
 Take the cholesky decomposition of this matrix.
int16 inverse (Matrix< R, C > &result) const
 Function to return the inverse of the matrix.
int16 pseudoinverse (Matrix< C, R > &result) const
void transpose (Matrix< C, R > &result) const
 Function to return the transpose of the matrix.
int16 trace (floating_point &result) const
 Function to return the trace of the matrix.
void setToZeros ()
 Function to set all elements of the matrix to zero.
int16 identity ()
 Function to set matrix to identity, if it is a square matrix.
int16 eye ()

Additional Inherited Members

Public Attributes inherited from clockwerk::Matrix< L, 1 >
std::array< std::array< floating_point, C >, R > values
Protected Member Functions inherited from clockwerk::Matrix< L, 1 >
int16 _checkLookupBoundaries (uint32 start_r, uint32 end_r, uint32 start_c, uint32 end_c) const
int16 _LUPDecompose (floating_point *A[R], uint32 P[R+1]) const
 Function to take a 2-d matrix represented by A and decompose it into LU form.

Detailed Description

template<uint32 L>
class clockwerk::CartesianVector< L >

Standard vector class derived from Matrix.

This file defines a simple vector class for cartesian systems in any number of dimensions. As an inherited class from the Matrix class defined in this directory, it can perform all matrix operations and has several operations of its own specific to vectors.

Constructor & Destructor Documentation

◆ CartesianVector() [1/6]

template<uint32 L>
clockwerk::CartesianVector< L >::CartesianVector ( )
inline

Redeclare constructors - note here that we're defining these to call their matrix counterparts, with the exception of the initializer list which we redefine for a vector Default constructor to initialize a vector to all zeroes

◆ CartesianVector() [2/6]

template<uint32 L>
clockwerk::CartesianVector< L >::CartesianVector ( floating_point elements)
inline

Constructor to initialize a matrix with all the same element.

◆ CartesianVector() [3/6]

template<uint32 L>
clockwerk::CartesianVector< L >::CartesianVector ( const floating_point(&) initial[L])

Constructor for Matrix class with initialization. Initializes matrix to values passed in via array

◆ CartesianVector() [4/6]

template<uint32 L>
clockwerk::CartesianVector< L >::CartesianVector ( const CartesianVector< L > & initial)

Copy constructor for Matrix class. Copies data from vector object to the current instance

◆ CartesianVector() [5/6]

template<uint32 L>
clockwerk::CartesianVector< L >::CartesianVector ( const Matrix< L, 1 > & initial)

Copy constructor for Matrix xlass. Copies data from matrix object to the current instance

◆ CartesianVector() [6/6]

template<uint32 L>
clockwerk::CartesianVector< L >::CartesianVector ( const std::array< floating_point, L > & initial)

Constructor for vector initialization via array.

◆ ~CartesianVector()

template<uint32 L>
clockwerk::CartesianVector< L >::~CartesianVector ( )
inline

Destructor – doesn't do anything because we don't dynamically allocate

Member Function Documentation

◆ get() [1/2]

template<uint32 L>
floating_point clockwerk::CartesianVector< L >::get ( uint32 idx) const
inline

Getter specific to the vector class.

Parameters
idxThe index to return
Returns
Value at index
Note
Does not bounds check index and should be treated safely

◆ get() [2/2]

template<uint32 L>
int clockwerk::CartesianVector< L >::get ( uint32 idx,
floating_point & result ) const
inline

Getter specific to the vector class.

Parameters
idxThe index to return
valuePBR return of the value in the vector
Returns
Integer value corresponding to error codes in clockwerkerrrors.h

◆ norm() [1/2]

template<uint32 L>
floating_point clockwerk::CartesianVector< L >::norm ( ) const
inline

Function to take the norm of a vector.

Returns
return of the norm operation

◆ norm() [2/2]

template<uint32 L>
int16 clockwerk::CartesianVector< L >::norm ( floating_point & result) const

Function to take the norm of a vector.

Parameters
resultPBR return of the norm operation

◆ normalize()

template<uint32 L>
int16 clockwerk::CartesianVector< L >::normalize ( )

Function to unitize the current vector.

Returns
Error code corresponding to those in clockwerkerrors.h

◆ normSquared() [1/2]

template<uint32 L>
floating_point clockwerk::CartesianVector< L >::normSquared ( ) const
inline

Function to take the squared norm of a vector.

Returns
return of the norm squared operation

◆ normSquared() [2/2]

template<uint32 L>
int16 clockwerk::CartesianVector< L >::normSquared ( floating_point & result) const

Function to take the squared norm of a vector.

Parameters
resultPBR return of the norm^2 operation

◆ operator[]()

template<uint32 L>
floating_point & clockwerk::CartesianVector< L >::operator[] ( uint32 idx)

Function to return a vector value.

Parameters
idxThe index to return
Returns
Reference to the vector element
Note
This vector, much like std::array, does not check index range and should be used accordingly

◆ set()

template<uint32 L>
int clockwerk::CartesianVector< L >::set ( uint32 idx,
floating_point value )
inline

Setter specific to the vector class.

Parameters
idxVector element to set
valueThe value to set the element to
Returns
Integer value corresponding to error codes in clockwerkerrrors.h

◆ unit()

template<uint32 L>
int16 clockwerk::CartesianVector< L >::unit ( CartesianVector< L > & result) const

Function to return the unitized version of the vector.

Parameters
resultPBR return of the unit vector
Returns
Error code corresponding to those in clockwerkerrors.h

◆ unitize()

template<uint32 L>
int16 clockwerk::CartesianVector< L >::unitize ( )

Function to unitize the current vector.

Returns
Error code corresponding to those in clockwerkerrors.h

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