Vector4< T > Class Template Reference

Class representing a 4-dimensional vector for both CPU and GPU. More...

Functions

_FCT_CPU_GPU_ int size () const
 Return the size of the sl::Vector4. More...
 
_FCT_CPU_GPU_ Vector4 ()
 Default constructor. More...
 
_FCT_CPU_GPU_ Vector4 (const T &t)
 Constructor. More...
 
_FCT_CPU_GPU_ Vector4 (const T *tp)
 Constructor. More...
 
_FCT_CPU_GPU_ Vector4 (const T v0, const T v1, const T v2, const T v3)
 Constructor. More...
 
_FCT_CPU_GPU_ Vector4 (const Vector4< T > &v)
 Copy constructor. More...
 
_FCT_CPU_GPU_ Vector4 (const Vector4< T > &v, const T d)
 Constructor. More...
 
_FCT_CPU_GPU_ Vector4 (const Vector3< T > &v, const T d=0)
 Constructor. More...
 
_FCT_CPU_GPU_ const T * ptr () const
 Returns a pointer of the first component. More...
 
_FCT_CPU_GPU_ Vector4< T > & setValues (const T *b)
 Sets the components of the sl::Vector1 to the values of the argument. More...
 
_FCT_CPU_GPU_ Vector4< T > & operator= (const Vector3< T > &other)
 Test the equality of the first three components of the sl::Vector4 with a sl::Vector3. More...
 
_FCT_CPU_GPU_ T & operator[] (int i)
 Returns the i-th component. More...
 
_FCT_CPU_GPU_ const T & operator[] (int i) const
 Returns the i-th component. More...
 
_FCT_CPU_GPU_ float norm ()
 Returns the norm of the sl::Vector4. More...
 
_FCT_CPU_GPU_ float square ()
 Returns the squared norm of the sl::Vector4. More...
 
_FCT_CPU_GPU_ float sum ()
 Returns the sum of the components of the sl::Vector4. More...
 

Static Functions

static _FCT_CPU_GPU_ float dot (const Vector4< T > &a, const Vector4< T > &b)
 Returns the dot product of two sl::Vector4. More...
 
static _FCT_CPU_GPU_ float distance (const Vector4< T > &a, const Vector4< T > &b)
 Returns the distance between two sl::Vector4. More...
 

Detailed Description

template<typename T>
class sl::Vector4< T >

Class representing a 4-dimensional vector for both CPU and GPU.

Constructor and Destructor

◆ Vector4() [1/7]

_FCT_CPU_GPU_ Vector4 ( )
inline

Default constructor.

Initialize the sl::Vector4 to 0.

◆ Vector4() [2/7]

_FCT_CPU_GPU_ Vector4 ( const T &  t)
inline

Constructor.

Initialize the sl::Vector4 to ( t, t, t, t ).

◆ Vector4() [3/7]

_FCT_CPU_GPU_ Vector4 ( const T *  tp)
inline

Constructor.

Initialize the sl::Vector4 with the component of the argument.

◆ Vector4() [4/7]

_FCT_CPU_GPU_ Vector4 ( const T  v0,
const T  v1,
const T  v2,
const T  v3 
)
inline

Constructor.

Initialize the sl::Vector4 to ( v0, v1, v2, v3 ).

◆ Vector4() [5/7]

_FCT_CPU_GPU_ Vector4 ( const Vector4< T > &  v)
inline

Copy constructor.

Initialize the sl::Vector4 by copying another sl::Vector4.

◆ Vector4() [6/7]

_FCT_CPU_GPU_ Vector4 ( const Vector4< T > &  v,
const T  d 
)
inline

Constructor.

Initialize the sl::Vector4 with the first three components of a sl::Vector4 and a scalar (for the forth component).

◆ Vector4() [7/7]

_FCT_CPU_GPU_ Vector4 ( const Vector3< T > &  v,
const T  d = 0 
)
inline

Constructor.

Initialize the sl::Vector4 with a sl::Vector3 and a scalar (for the forth component).

Functions

◆ size()

_FCT_CPU_GPU_ int size ( ) const
inline

Return the size of the sl::Vector4.

Returns
4

◆ ptr()

_FCT_CPU_GPU_ const T* ptr ( ) const
inline

Returns a pointer of the first component.

◆ setValues()

_FCT_CPU_GPU_ Vector4<T>& setValues ( const T *  b)
inline

Sets the components of the sl::Vector1 to the values of the argument.

◆ operator=()

_FCT_CPU_GPU_ Vector4<T>& operator= ( const Vector3< T > &  other)
inline

Test the equality of the first three components of the sl::Vector4 with a sl::Vector3.

◆ operator[]() [1/2]

_FCT_CPU_GPU_ T& operator[] ( int  i)
inline

Returns the i-th component.

◆ operator[]() [2/2]

_FCT_CPU_GPU_ const T& operator[] ( int  i) const
inline

Returns the i-th component.

◆ norm()

_FCT_CPU_GPU_ float norm ( )
inline

Returns the norm of the sl::Vector4.

◆ square()

_FCT_CPU_GPU_ float square ( )
inline

Returns the squared norm of the sl::Vector4.

◆ sum()

_FCT_CPU_GPU_ float sum ( )
inline

Returns the sum of the components of the sl::Vector4.

◆ dot()

static _FCT_CPU_GPU_ float dot ( const Vector4< T > &  a,
const Vector4< T > &  b 
)
inlinestatic

Returns the dot product of two sl::Vector4.

◆ distance()

static _FCT_CPU_GPU_ float distance ( const Vector4< T > &  a,
const Vector4< T > &  b 
)
inlinestatic

Returns the distance between two sl::Vector4.