OpenVDB 14.0.0
Loading...
Searching...
No Matches
Mat3x2< T > Class Template Reference

3x2 row-major matrix. More...

#include <nanovdb/math/Math.h>

Public Types

using ValueType

Public Member Functions

 Mat3x2 () noexcept=default
 Default-construct (entries left uninitialized for fundamental T).
__hostdev__ constexpr Mat3x2 (T a, T b, T c, T d, T e, T f) noexcept
 Constructor given individual array elements, the ordering is in row major form:
template<typename Source>
__hostdev__ constexpr Mat3x2 (Source *a) noexcept
 Constructor given array of elements, the ordering is in row major form.
__hostdev__ constexpr Mat3x2 operator- () const noexcept
__hostdev__ constexpr Mat3x2 operator+ (const Mat3x2 &m) const noexcept
__hostdev__ constexpr Mat3x2 operator- (const Mat3x2 &m) const noexcept
__hostdev__ constexpr Mat3x2 & operator+= (const Mat3x2 &m) noexcept
__hostdev__ constexpr Mat3x2 & operator-= (const Mat3x2 &m) noexcept
__hostdev__ constexpr Vec3< T > operator* (const Vec2< T > &v) const noexcept
__hostdev__ constexpr Mat3x2 operator* (const T &s) const noexcept
__hostdev__ constexpr Mat3x2 operator/ (const T &s) const noexcept
__hostdev__ constexpr Mat3x2 & operator*= (const T &s) noexcept
__hostdev__ constexpr Mat3x2 & operator/= (const T &s) noexcept
__hostdev__ constexpr bool operator== (const Mat3x2 &m) const noexcept
__hostdev__ constexpr bool operator!= (const Mat3x2 &m) const noexcept
__hostdev__ constexpr Mat2x3< T > transpose () const noexcept
 returns transpose of this
__hostdev__ constexpr T * operator[] (int row) noexcept
 2D row access. Returns a pointer to the start of row; the caller indexes into it with the column. Asserts 0 <= row < ROWS in debug builds; column index is the caller's responsibility (use 0 <= col < COLS).
__hostdev__ constexpr const T * operator[] (int row) const noexcept
 Const overload of operator[](int); see non-const variant.
__hostdev__ constexpr T * data () noexcept
 return a raw pointer to the underlying 1D storage (row-major)
__hostdev__ constexpr const T * data () const noexcept
 return a const raw pointer to the underlying 1D storage (row-major)
__hostdev__ constexpr Derived plus (const Derived &rhs) const noexcept
 return *this + rhs as a Derived
__hostdev__ constexpr Derived minus (const Derived &rhs) const noexcept
 return *this - rhs as a Derived
__hostdev__ constexpr Derived negate () const noexcept
 return -(*this) as a Derived
__hostdev__ constexpr Derived scale (T s) const noexcept
 return s * (*this) as a Derived
__hostdev__ constexpr MatBase & addAssign (const MatBase &rhs) noexcept
 Element-wise add rhs into *this and return *this.
__hostdev__ constexpr MatBase & subAssign (const MatBase &rhs) noexcept
 Element-wise subtract rhs from *this and return *this.
__hostdev__ constexpr MatBase & scaleAssign (T s) noexcept
 Multiply every element by scalar s in place; return *this. s is taken by value so m *= m[0][0] scales every element by the original value.
__hostdev__ constexpr Derived divideBy (T s) const noexcept
 return (*this) / s element-wise as a Derived. Floating-point T multiplies by the reciprocal 1/s; integer T divides each element, since 1/s would truncate to zero.
__hostdev__ constexpr MatBase & divideAssignScalar (T s) noexcept
 Divide every element by scalar s in place; return *this. Uses the same floating-point reciprocal / integer per-element split as divideBy. s is taken by value so m /= m[0][0] is safe.
__hostdev__ constexpr bool equals (const MatBase &rhs) const noexcept
 Return true iff every element compares equal to rhs.
__hostdev__ constexpr Result transposeAs () const noexcept
 return the transpose of *this as the Result type.
__hostdev__ constexpr Result multiply (const Rhs &rhs) const noexcept
 return (*this) * rhs as the Result type.
__hostdev__ constexpr VecResult multiplyVec (const VecRhs &v) const noexcept
 return (*this) * v as the VecResult type.

Static Public Member Functions

static __hostdev__ constexpr int rows () noexcept
 Compile-time row count.
static __hostdev__ constexpr int cols () noexcept
 Compile-time column count.
static __hostdev__ constexpr int size () noexcept
 Compile-time element count, i.e. ROWS * COLS.

Static Protected Member Functions

static __hostdev__ constexpr Result generate (F f, std::integer_sequence< int, I... >) noexcept
 Return a Result whose row-major element idx is f(idx), built through its Count-element constructor. This is constexpr-valid in C++17 without first value-initializing a result and overwriting it.
static __hostdev__ constexpr Result generate (F f) noexcept

Protected Attributes

T mData [ROWS *COLS]

Friends

__hostdev__ friend constexpr Mat3x2 operator* (const T &s, const Mat3x2 &m) noexcept
 scalar * Mat (hidden friend — found only via ADL on Mat3x2)

Detailed Description

template<typename T>
class nanovdb::math::Mat3x2< T >

3x2 row-major matrix.

Intentionally NOT alignas-elevated: its byte size (6*sizeof(T)) is not a power-of-2 multiple of alignof(T), so any alignas(N > alignof(T)) would force tail padding and break packed-array layout plus on-disk format compatibility.

Member Typedef Documentation

◆ ValueType

using ValueType
inherited

Constructor & Destructor Documentation

◆ Mat3x2() [1/3]

template<typename T>
Mat3x2 ( )
defaultnoexcept

Default-construct (entries left uninitialized for fundamental T).

◆ Mat3x2() [2/3]

template<typename T>
__hostdev__ constexpr Mat3x2 ( T a,
T b,
T c,
T d,
T e,
T f )
inlineconstexprnoexcept

Constructor given individual array elements, the ordering is in row major form:

a b
c d
e f

◆ Mat3x2() [3/3]

template<typename T>
template<typename Source>
__hostdev__ constexpr Mat3x2 ( Source * a)
inlineconstexprnoexcept

Constructor given array of elements, the ordering is in row major form.

Member Function Documentation

◆ addAssign()

__hostdev__ constexpr MatBase & addAssign ( const MatBase< T, 3, 2 > & rhs)
inlineconstexprnoexceptinherited

Element-wise add rhs into *this and return *this.

◆ cols()

__hostdev__ constexpr int cols ( )
inlinestaticnodiscardconstexprnoexceptinherited

Compile-time column count.

◆ data() [1/2]

__hostdev__ constexpr const T * data ( ) const
inlineconstexprnoexceptinherited

return a const raw pointer to the underlying 1D storage (row-major)

◆ data() [2/2]

__hostdev__ constexpr T * data ( )
inlineconstexprnoexceptinherited

return a raw pointer to the underlying 1D storage (row-major)

◆ divideAssignScalar()

__hostdev__ constexpr MatBase & divideAssignScalar ( T s)
inlineconstexprnoexceptinherited

Divide every element by scalar s in place; return *this. Uses the same floating-point reciprocal / integer per-element split as divideBy. s is taken by value so m /= m[0][0] is safe.

◆ divideBy()

__hostdev__ constexpr Derived divideBy ( T s) const
inlinenodiscardconstexprnoexceptinherited

return (*this) / s element-wise as a Derived. Floating-point T multiplies by the reciprocal 1/s; integer T divides each element, since 1/s would truncate to zero.

◆ equals()

__hostdev__ constexpr bool equals ( const MatBase< T, 3, 2 > & rhs) const
inlinenodiscardconstexprnoexceptinherited

Return true iff every element compares equal to rhs.

◆ generate() [1/2]

__hostdev__ constexpr Result generate ( F f)
inlinestaticconstexprprotectednoexceptinherited

◆ generate() [2/2]

__hostdev__ constexpr Result generate ( F f,
std::integer_sequence< int, I... >  )
inlinestaticconstexprprotectednoexceptinherited

Return a Result whose row-major element idx is f(idx), built through its Count-element constructor. This is constexpr-valid in C++17 without first value-initializing a result and overwriting it.

◆ minus()

__hostdev__ constexpr Derived minus ( const Derived & rhs) const
inlinenodiscardconstexprnoexceptinherited

return *this - rhs as a Derived

◆ multiply()

__hostdev__ constexpr Result multiply ( const Rhs & rhs) const
inlinenodiscardconstexprnoexceptinherited

return (*this) * rhs as the Result type.

Template Parameters
Resulta matrix type whose dimensions are (ROWS, Rhs::cols())
Rhsa matrix type whose row count equals COLS

◆ multiplyVec()

__hostdev__ constexpr VecResult multiplyVec ( const VecRhs & v) const
inlinenodiscardconstexprnoexceptinherited

return (*this) * v as the VecResult type.

Template Parameters
VecResulta vector type whose SIZE equals ROWS
VecRhsa vector type whose SIZE equals COLS

◆ negate()

__hostdev__ constexpr Derived negate ( ) const
inlinenodiscardconstexprnoexceptinherited

return -(*this) as a Derived

◆ operator!=()

template<typename T>
__hostdev__ constexpr bool operator!= ( const Mat3x2< T > & m) const
inlinenodiscardconstexprnoexcept

◆ operator*() [1/2]

template<typename T>
__hostdev__ constexpr Mat3x2 operator* ( const T & s) const
inlinenodiscardconstexprnoexcept

◆ operator*() [2/2]

template<typename T>
__hostdev__ constexpr Vec3< T > operator* ( const Vec2< T > & v) const
inlinenodiscardconstexprnoexcept

◆ operator*=()

template<typename T>
__hostdev__ constexpr Mat3x2 & operator*= ( const T & s)
inlineconstexprnoexcept

◆ operator+()

template<typename T>
__hostdev__ constexpr Mat3x2 operator+ ( const Mat3x2< T > & m) const
inlinenodiscardconstexprnoexcept

◆ operator+=()

template<typename T>
__hostdev__ constexpr Mat3x2 & operator+= ( const Mat3x2< T > & m)
inlineconstexprnoexcept

◆ operator-() [1/2]

template<typename T>
__hostdev__ constexpr Mat3x2 operator- ( ) const
inlinenodiscardconstexprnoexcept

◆ operator-() [2/2]

template<typename T>
__hostdev__ constexpr Mat3x2 operator- ( const Mat3x2< T > & m) const
inlinenodiscardconstexprnoexcept

◆ operator-=()

template<typename T>
__hostdev__ constexpr Mat3x2 & operator-= ( const Mat3x2< T > & m)
inlineconstexprnoexcept

◆ operator/()

template<typename T>
__hostdev__ constexpr Mat3x2 operator/ ( const T & s) const
inlinenodiscardconstexprnoexcept

◆ operator/=()

template<typename T>
__hostdev__ constexpr Mat3x2 & operator/= ( const T & s)
inlineconstexprnoexcept

◆ operator==()

template<typename T>
__hostdev__ constexpr bool operator== ( const Mat3x2< T > & m) const
inlinenodiscardconstexprnoexcept

◆ operator[]() [1/2]

__hostdev__ constexpr const T * operator[] ( int row) const
inlineconstexprnoexceptinherited

Const overload of operator[](int); see non-const variant.

◆ operator[]() [2/2]

__hostdev__ constexpr T * operator[] ( int row)
inlineconstexprnoexceptinherited

2D row access. Returns a pointer to the start of row; the caller indexes into it with the column. Asserts 0 <= row < ROWS in debug builds; column index is the caller's responsibility (use 0 <= col < COLS).

◆ plus()

__hostdev__ constexpr Derived plus ( const Derived & rhs) const
inlinenodiscardconstexprnoexceptinherited

return *this + rhs as a Derived

◆ rows()

__hostdev__ constexpr int rows ( )
inlinestaticnodiscardconstexprnoexceptinherited

Compile-time row count.

◆ scale()

__hostdev__ constexpr Derived scale ( T s) const
inlinenodiscardconstexprnoexceptinherited

return s * (*this) as a Derived

◆ scaleAssign()

__hostdev__ constexpr MatBase & scaleAssign ( T s)
inlineconstexprnoexceptinherited

Multiply every element by scalar s in place; return *this. s is taken by value so m *= m[0][0] scales every element by the original value.

◆ size()

__hostdev__ constexpr int size ( )
inlinestaticnodiscardconstexprnoexceptinherited

Compile-time element count, i.e. ROWS * COLS.

◆ subAssign()

__hostdev__ constexpr MatBase & subAssign ( const MatBase< T, 3, 2 > & rhs)
inlineconstexprnoexceptinherited

Element-wise subtract rhs from *this and return *this.

◆ transpose()

template<typename T>
__hostdev__ constexpr Mat2x3< T > transpose ( ) const
inlinenodiscardconstexprnoexcept

returns transpose of this

◆ transposeAs()

__hostdev__ constexpr Result transposeAs ( ) const
inlinenodiscardconstexprnoexceptinherited

return the transpose of *this as the Result type.

Template Parameters
Resulta matrix type whose dimensions are (COLS, ROWS)

◆ operator*

template<typename T>
__hostdev__ friend constexpr Mat3x2 operator* ( const T & s,
const Mat3x2< T > & m )
friend

scalar * Mat (hidden friend — found only via ADL on Mat3x2)

Member Data Documentation

◆ mData

T mData[ROWS *COLS]
protectedinherited