Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Static Public Member Functions | Friends | List of all members
om::math::SIMDArray< Float32, width > Class Template Reference

A class representing an N-component 32-bit floating-point SIMD scalar. More...

#include <omSIMDArrayFloat32.h>

Public Member Functions

 SIMDArray ()
 Create a new SIMD scalar with all elements left uninitialized. More...
 
 SIMDArray (Float32 value)
 Create a new SIMD scalar with all elements equal to the specified value. More...
 
 SIMDArray (const Float32 *array)
 Create a new SIMD scalar from the first N values stored at specified pointer's location. More...
 
Float32 sumScalar () const
 Return the horizontal sum of all components of this SIMD scalar. More...
 
void store (Float32 *destination) const
 Store this SIMD scalar starting at the specified aligned destination pointer. More...
 
void storeUnaligned (Float32 *destination) const
 Store this SIMD scalar starting at the specified unaligned destination pointer. More...
 
Float32operator[] (Index i)
 Get a reference to the value stored at the specified component index in this scalar. More...
 
Float32 operator[] (Index i) const
 Get the value stored at the specified component index in this scalar. More...
 
const Float32toArray () const
 Get a pointer to the first element in this scalar. More...
 
SIMDArray< Int32, width > operator== (const SIMDArray &scalar) const
 Compare two 4D SIMD scalars component-wise for equality. More...
 
SIMDArray< Int32, width > operator== (const Float32 value) const
 Compare this scalar to a single floating point value for equality. More...
 
SIMDArray< Int32, width > operator!= (const SIMDArray &scalar) const
 Compare two 4D SIMD scalars component-wise for inequality. More...
 
SIMDArray< Int32, width > operator!= (const Float32 value) const
 Compare this scalar to a single floating point value for inequality. More...
 
SIMDArray< Int32, width > operator< (const SIMDArray &scalar) const
 Perform a component-wise less-than comparison between this an another 4D SIMD scalar. More...
 
SIMDArray< Int32, width > operator< (const Float32 value) const
 Perform a component-wise less-than comparison between this 4D SIMD scalar and an expanded scalar. More...
 
SIMDArray< Int32, width > operator> (const SIMDArray &scalar) const
 Perform a component-wise greater-than comparison between this an another 4D SIMD scalar. More...
 
SIMDArray< Int32, width > operator> (const Float32 value) const
 Perform a component-wise greater-than comparison between this 4D SIMD scalar and an expanded scalar. More...
 
SIMDArray< Int32, width > operator<= (const SIMDArray &scalar) const
 Perform a component-wise less-than-or-equal-to comparison between this an another 4D SIMD scalar. More...
 
SIMDArray< Int32, width > operator<= (const Float32 value) const
 Perform a component-wise less-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. More...
 
SIMDArray< Int32, width > operator>= (const SIMDArray &scalar) const
 Perform a component-wise greater-than-or-equal-to comparison between this an another 4D SIMD scalar. More...
 
SIMDArray< Int32, width > operator>= (const Float32 value) const
 Perform a component-wise greater-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. More...
 
SIMDArray operator- () const
 Negate a scalar. More...
 
SIMDArray operator+ (const SIMDArray &scalar) const
 Add this scalar to another and return the result. More...
 
SIMDArray operator+ (const Float32 value) const
 Add a value to every component of this scalar. More...
 
SIMDArray operator- (const SIMDArray &scalar) const
 Subtract a scalar from this scalar component-wise and return the result. More...
 
SIMDArray operator- (const Float32 value) const
 Subtract a value from every component of this scalar. More...
 
SIMDArray operator* (const SIMDArray &scalar) const
 Multiply component-wise this scalar and another scalar. More...
 
SIMDArray operator* (const Float32 value) const
 Multiply every component of this scalar by a value and return the result. More...
 
SIMDArray operator/ (const SIMDArray &scalar) const
 Divide this scalar by another scalar component-wise. More...
 
SIMDArray operator/ (const Float32 value) const
 Divide every component of this scalar by a value and return the result. More...
 
SIMDArrayoperator+= (const SIMDArray &scalar)
 Add a scalar to this scalar, modifying this original scalar. More...
 
SIMDArrayoperator-= (const SIMDArray &scalar)
 Subtract a scalar from this scalar, modifying this original scalar. More...
 
SIMDArrayoperator*= (const SIMDArray &scalar)
 Multiply component-wise this scalar and another scalar and modify this scalar. More...
 
SIMDArrayoperator/= (const SIMDArray &scalar)
 Divide this scalar by another scalar component-wise and modify this scalar. More...
 
data::String toString () const
 Convert this SIMD array into a human-readable string representation. More...
 
 operator data::String () const
 Convert this SIMD array into a human-readable string representation. More...
 

Static Public Member Functions

static SIMDArray load (const Float32 *array)
 Load a SIMD array from the specified aligned pointer to values. More...
 
static SIMDArray loadUnaligned (const Float32 *array)
 Load a SIMD array from the specified unaligned pointer to values. More...
 
static Size getWidth ()
 Get the width of this scalar (number of components it has). More...
 
static Size getAlignment ()
 Return the alignment required for objects of this type. More...
 

Friends

template<Size width2>
SIMDArray< Float32, width2 > abs (const SIMDArray< Float32, width2 > &scalar)
 
template<Size width2>
SIMDArray< Float32, width2 > ceiling (const SIMDArray< Float32, width2 > &scalar)
 
template<Size width2>
SIMDArray< Float32, width2 > floor (const SIMDArray< Float32, width2 > &scalar)
 
template<Size width2>
SIMDArray< Float32, width2 > sqrt (const SIMDArray< Float32, width2 > &scalar)
 
template<Size width2>
SIMDArray< Float32, width2 > min (const SIMDArray< Float32, width2 > &scalar1, const SIMDArray< Float32, width2 > &scalar2)
 
template<Size width2>
SIMDArray< Float32, width2 > max (const SIMDArray< Float32, width2 > &scalar1, const SIMDArray< Float32, width2 > &scalar2)
 
template<Size width2>
SIMDArray< Float32, width2 > select (const SIMDArray< Int32, width2 > &selector, const SIMDArray< Float32, width2 > &scalar1, const SIMDArray< Float32, width2 > &scalar2)
 
template<Size width2>
SIMDArray< Float32, width2 > ln (const SIMDArray< Float32, width2 > &scalar)
 
template<Size width2>
SIMDArray< Float32, width2 > log10 (const SIMDArray< Float32, width2 > &scalar)
 
template<Size width2>
SIMDArray< Float32, width2 > sin (const SIMDArray< Float32, width2 > &scalar)
 
template<Size width2>
SIMDArray< Float32, width2 > cos (const SIMDArray< Float32, width2 > &scalar)
 

Detailed Description

template<Size width>
class om::math::SIMDArray< Float32, width >

A class representing an N-component 32-bit floating-point SIMD scalar.

This specialization of the SIMDScalar class uses one or more 4-component SIMD values to simulate an N-wide SIMD register.

Constructor & Destructor Documentation

template<Size width>
om::math::SIMDArray< Float32, width >::SIMDArray ( )
inline

Create a new SIMD scalar with all elements left uninitialized.

template<Size width>
om::math::SIMDArray< Float32, width >::SIMDArray ( Float32  value)
inline

Create a new SIMD scalar with all elements equal to the specified value.

template<Size width>
om::math::SIMDArray< Float32, width >::SIMDArray ( const Float32 array)
inlineexplicit

Create a new SIMD scalar from the first N values stored at specified pointer's location.

Member Function Documentation

template<Size width>
static SIMDArray om::math::SIMDArray< Float32, width >::load ( const Float32 array)
inlinestatic

Load a SIMD array from the specified aligned pointer to values.

template<Size width>
static SIMDArray om::math::SIMDArray< Float32, width >::loadUnaligned ( const Float32 array)
inlinestatic

Load a SIMD array from the specified unaligned pointer to values.

template<Size width>
Float32 om::math::SIMDArray< Float32, width >::sumScalar ( ) const
inline

Return the horizontal sum of all components of this SIMD scalar.

template<Size width>
void om::math::SIMDArray< Float32, width >::store ( Float32 destination) const
inline

Store this SIMD scalar starting at the specified aligned destination pointer.

template<Size width>
void om::math::SIMDArray< Float32, width >::storeUnaligned ( Float32 destination) const
inline

Store this SIMD scalar starting at the specified unaligned destination pointer.

template<Size width>
Float32& om::math::SIMDArray< Float32, width >::operator[] ( Index  i)
inline

Get a reference to the value stored at the specified component index in this scalar.

template<Size width>
Float32 om::math::SIMDArray< Float32, width >::operator[] ( Index  i) const
inline

Get the value stored at the specified component index in this scalar.

template<Size width>
const Float32* om::math::SIMDArray< Float32, width >::toArray ( ) const
inline

Get a pointer to the first element in this scalar.

The remaining values are in the next 3 locations after the first element.

template<Size width>
static Size om::math::SIMDArray< Float32, width >::getWidth ( )
inlinestatic

Get the width of this scalar (number of components it has).

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator== ( const SIMDArray< Float32, width > &  scalar) const
inline

Compare two 4D SIMD scalars component-wise for equality.

Return a 4D scalar of booleans indicating the result of the comparison. If each corresponding pair of components is equal, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator== ( const Float32  value) const
inline

Compare this scalar to a single floating point value for equality.

Return a 4D scalar of booleans indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components is equal, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator!= ( const SIMDArray< Float32, width > &  scalar) const
inline

Compare two 4D SIMD scalars component-wise for inequality.

Return a 4D scalar of booleans indicating the result of the comparison. If each corresponding pair of components is not equal, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator!= ( const Float32  value) const
inline

Compare this scalar to a single floating point value for inequality.

Return a 4D scalar of booleans indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components is not equal, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator< ( const SIMDArray< Float32, width > &  scalar) const
inline

Perform a component-wise less-than comparison between this an another 4D SIMD scalar.

Return a 4D scalar of booleans indicating the result of the comparison. If each corresponding pair of components has this scalar's component less than the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator< ( const Float32  value) const
inline

Perform a component-wise less-than comparison between this 4D SIMD scalar and an expanded scalar.

Return a 4D scalar of booleans indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components has this scalar's component less than the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator> ( const SIMDArray< Float32, width > &  scalar) const
inline

Perform a component-wise greater-than comparison between this an another 4D SIMD scalar.

Return a 4D scalar of booleans indicating the result of the comparison. If each corresponding pair of components has this scalar's component greater than the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator> ( const Float32  value) const
inline

Perform a component-wise greater-than comparison between this 4D SIMD scalar and an expanded scalar.

Return a 4D scalar of integers indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components has this scalar's component greater than the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator<= ( const SIMDArray< Float32, width > &  scalar) const
inline

Perform a component-wise less-than-or-equal-to comparison between this an another 4D SIMD scalar.

Return a 4D scalar of integers indicating the result of the comparison. If each corresponding pair of components has this scalar's component less than or equal to the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator<= ( const Float32  value) const
inline

Perform a component-wise less-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar.

Return a 4D scalar of integers indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components has this scalar's component less than or equal to the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator>= ( const SIMDArray< Float32, width > &  scalar) const
inline

Perform a component-wise greater-than-or-equal-to comparison between this an another 4D SIMD scalar.

Return a 4D scalar of integers indicating the result of the comparison. If each corresponding pair of components has this scalar's component greater than or equal to the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray<Int32,width> om::math::SIMDArray< Float32, width >::operator>= ( const Float32  value) const
inline

Perform a component-wise greater-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar.

Return a 4D scalar of integers indicating the result of the comparison. The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. If each corresponding pair of components has this scalar's component greater than or equal to the other scalar's component, the corresponding result component is non-zero. Otherwise, that result component is equal to zero.

template<Size width>
SIMDArray om::math::SIMDArray< Float32, width >::operator- ( ) const
inline

Negate a scalar.

This method negates every component of this 4D SIMD scalar and returns the result, leaving this scalar unmodified.

Returns
the negation of the original scalar.
template<Size width>
SIMDArray om::math::SIMDArray< Float32, width >::operator+ ( const SIMDArray< Float32, width > &  scalar) const
inline

Add this scalar to another and return the result.

This method adds another scalar to this one, component-wise, and returns this addition. It does not modify either of the original scalars.

Parameters
scalar- The scalar to add to this one.
Returns
The addition of this scalar and the parameter.
template<Size width>
SIMDArray om::math::SIMDArray< Float32, width >::operator+ ( const Float32  value) const
inline

Add a value to every component of this scalar.

This method adds the value parameter to every component of the scalar, and returns a scalar representing this result. It does not modifiy the original scalar.

Parameters
value- The value to add to all components of this scalar.
Returns
The resulting scalar of this addition.
template<Size width>
SIMDArray om::math::SIMDArray< Float32, width >::operator- ( const SIMDArray< Float32, width > &  scalar) const
inline

Subtract a scalar from this scalar component-wise and return the result.

This method subtracts another scalar from this one, component-wise, and returns this subtraction. It does not modify either of the original scalars.

Parameters
scalar- The scalar to subtract from this one.
Returns
The subtraction of the the parameter from this scalar.
template<Size width>
SIMDArray om::math::SIMDArray< Float32, width >::operator- ( const Float32  value) const
inline

Subtract a value from every component of this scalar.

This method subtracts the value parameter from every component of the scalar, and returns a scalar representing this result. It does not modifiy the original scalar.

Parameters
value- The value to subtract from all components of this scalar.
Returns
The resulting scalar of this subtraction.
template<Size width>
SIMDArray om::math::SIMDArray< Float32, width >::operator* ( const SIMDArray< Float32, width > &  scalar) const
inline

Multiply component-wise this scalar and another scalar.

This operator multiplies each component of this scalar by the corresponding component of the other scalar and returns a scalar representing this result. It does not modify either original scalar.

Parameters
scalar- The scalar to multiply this scalar by.
Returns
The result of the multiplication.
template<Size width>
SIMDArray om::math::SIMDArray< Float32, width >::operator* ( const Float32  value) const
inline

Multiply every component of this scalar by a value and return the result.

This method multiplies the value parameter with every component of the scalar, and returns a scalar representing this result. It does not modifiy the original scalar.

Parameters
value- The value to multiplly with all components of this scalar.
Returns
The resulting scalar of this multiplication.
template<Size width>
SIMDArray om::math::SIMDArray< Float32, width >::operator/ ( const SIMDArray< Float32, width > &  scalar) const
inline

Divide this scalar by another scalar component-wise.

This operator divides each component of this scalar by the corresponding component of the other scalar and returns a scalar representing this result. It does not modify either original scalar.

Parameters
scalar- The scalar to multiply this scalar by.
Returns
The result of the division.
template<Size width>
SIMDArray om::math::SIMDArray< Float32, width >::operator/ ( const Float32  value) const
inline

Divide every component of this scalar by a value and return the result.

This method Divides every component of the scalar by the value parameter, and returns a scalar representing this result. It does not modifiy the original scalar.

Parameters
value- The value to divide all components of this scalar by.
Returns
The resulting scalar of this division.
template<Size width>
SIMDArray& om::math::SIMDArray< Float32, width >::operator+= ( const SIMDArray< Float32, width > &  scalar)
inline

Add a scalar to this scalar, modifying this original scalar.

This method adds another scalar to this scalar, component-wise, and sets this scalar to have the result of this addition.

Parameters
scalar- The scalar to add to this scalar.
Returns
A reference to this modified scalar.
template<Size width>
SIMDArray& om::math::SIMDArray< Float32, width >::operator-= ( const SIMDArray< Float32, width > &  scalar)
inline

Subtract a scalar from this scalar, modifying this original scalar.

This method subtracts another scalar from this scalar, component-wise, and sets this scalar to have the result of this subtraction.

Parameters
scalar- The scalar to subtract from this scalar.
Returns
A reference to this modified scalar.
template<Size width>
SIMDArray& om::math::SIMDArray< Float32, width >::operator*= ( const SIMDArray< Float32, width > &  scalar)
inline

Multiply component-wise this scalar and another scalar and modify this scalar.

This operator multiplies each component of this scalar by the corresponding component of the other scalar and modifies this scalar to contain the result.

Parameters
scalar- The scalar to multiply this scalar by.
Returns
A reference to this modified scalar.
template<Size width>
SIMDArray& om::math::SIMDArray< Float32, width >::operator/= ( const SIMDArray< Float32, width > &  scalar)
inline

Divide this scalar by another scalar component-wise and modify this scalar.

This operator divides each component of this scalar by the corresponding component of the other scalar and modifies this scalar to contain the result.

Parameters
scalar- The scalar to divide this scalar by.
Returns
A reference to this modified scalar.
template<Size width>
static Size om::math::SIMDArray< Float32, width >::getAlignment ( )
inlinestatic

Return the alignment required for objects of this type.

For most SIMD types this value will be 16 bytes. If there is no alignment required, 0 is returned.

template<Size width>
data::String om::math::SIMDArray< Float32, width >::toString ( ) const
inline

Convert this SIMD array into a human-readable string representation.

template<Size width>
om::math::SIMDArray< Float32, width >::operator data::String ( ) const
inline

Convert this SIMD array into a human-readable string representation.

Friends And Related Function Documentation

template<Size width>
template<Size width2>
SIMDArray<Float32,width2> abs ( const SIMDArray< Float32, width2 > &  scalar)
friend
template<Size width>
template<Size width2>
SIMDArray<Float32,width2> ceiling ( const SIMDArray< Float32, width2 > &  scalar)
friend
template<Size width>
template<Size width2>
SIMDArray<Float32,width2> floor ( const SIMDArray< Float32, width2 > &  scalar)
friend
template<Size width>
template<Size width2>
SIMDArray<Float32,width2> sqrt ( const SIMDArray< Float32, width2 > &  scalar)
friend
template<Size width>
template<Size width2>
SIMDArray<Float32,width2> min ( const SIMDArray< Float32, width2 > &  scalar1,
const SIMDArray< Float32, width2 > &  scalar2 
)
friend
template<Size width>
template<Size width2>
SIMDArray<Float32,width2> max ( const SIMDArray< Float32, width2 > &  scalar1,
const SIMDArray< Float32, width2 > &  scalar2 
)
friend
template<Size width>
template<Size width2>
SIMDArray<Float32,width2> select ( const SIMDArray< Int32, width2 > &  selector,
const SIMDArray< Float32, width2 > &  scalar1,
const SIMDArray< Float32, width2 > &  scalar2 
)
friend
template<Size width>
template<Size width2>
SIMDArray<Float32,width2> ln ( const SIMDArray< Float32, width2 > &  scalar)
friend
template<Size width>
template<Size width2>
SIMDArray<Float32,width2> log10 ( const SIMDArray< Float32, width2 > &  scalar)
friend
template<Size width>
template<Size width2>
SIMDArray<Float32,width2> sin ( const SIMDArray< Float32, width2 > &  scalar)
friend
template<Size width>
template<Size width2>
SIMDArray<Float32,width2> cos ( const SIMDArray< Float32, width2 > &  scalar)
friend

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