Matrix< T, M, N > Class Template Reference

Matrix&lt; T, M, N &gt; Class Template Reference#

4 min read time

Applies to Linux

rocCV: roccv::detail::math::Matrix< T, M, N > Class Template Reference
roccv::detail::math::Matrix< T, M, N > Class Template Reference

Defines a matrix object. More...

#include <math.hpp>

Public Types

using Type = T
 

Public Member Functions

__host__ __device__ int cols () const
 Returns the number of columns in the matrix. More...
 
__host__ __device__ void load (const T *data)
 Loads a row-major array into the matrix. More...
 
__host__ __device__ Vector< T, N > & operator[] (int i)
 Returns a row of a matrix as a vector reference. More...
 
const __host__ __device__ Vector< T, N > & operator[] (int i) const
 Returns a row of a matrix as a constant vector reference. More...
 
__host__ __device__ T & operator[] (int2 c)
 Returns a data reference from the matrix. More...
 
const __host__ __device__ T & operator[] (int2 c) const
 Returns a constant data reference from the matrix. More...
 
__host__ __device__ int rows () const
 Returns the number of rows in a matrix. More...
 
__host__ __device__ void store (T *data)
 Stores data from the matrix into a 1D array in row-major order. More...
 

Public Attributes

Vector< T, N > data_ [M]
 

Detailed Description

template<class T, int M, int N = M>
class roccv::detail::math::Matrix< T, M, N >

Defines a matrix object.

Template Parameters
TThe type of the matrix.
MNumber of rows in the matrix.
NNumber of columns in the matrix.

Member Typedef Documentation

◆ Type

template<class T , int M, int N = M>
using roccv::detail::math::Matrix< T, M, N >::Type = T

Member Function Documentation

◆ cols()

template<class T , int M, int N = M>
__host__ __device__ int roccv::detail::math::Matrix< T, M, N >::cols ( ) const
inline

Returns the number of columns in the matrix.

Returns
The number of columns in the matrix.

◆ load()

template<class T , int M, int N = M>
__host__ __device__ void roccv::detail::math::Matrix< T, M, N >::load ( const T *  data)
inline

Loads a row-major array into the matrix.

Parameters
dataAn array of type T.

◆ operator[]() [1/4]

template<class T , int M, int N = M>
__host__ __device__ Vector<T, N>& roccv::detail::math::Matrix< T, M, N >::operator[] ( int  i)
inline

Returns a row of a matrix as a vector reference.

Parameters
iThe row of the matrix to return.
Returns
A reference to a vector representing a row of the matrix.

◆ operator[]() [2/4]

template<class T , int M, int N = M>
const __host__ __device__ Vector<T, N>& roccv::detail::math::Matrix< T, M, N >::operator[] ( int  i) const
inline

Returns a row of a matrix as a constant vector reference.

Parameters
iThe row to return.
Returns
A row of the matrix represented as a vector.

◆ operator[]() [3/4]

template<class T , int M, int N = M>
__host__ __device__ T& roccv::detail::math::Matrix< T, M, N >::operator[] ( int2  c)
inline

Returns a data reference from the matrix.

Parameters
cAn int2 coordinate in the form {col, row}
Returns
A data reference from the matrix.

◆ operator[]() [4/4]

template<class T , int M, int N = M>
const __host__ __device__ T& roccv::detail::math::Matrix< T, M, N >::operator[] ( int2  c) const
inline

Returns a constant data reference from the matrix.

Parameters
cAn int2 coordinate in the form {col, row}
Returns
A constant data reference from the matrix.

◆ rows()

template<class T , int M, int N = M>
__host__ __device__ int roccv::detail::math::Matrix< T, M, N >::rows ( ) const
inline

Returns the number of rows in a matrix.

Returns
The number of rows in the matrix.

◆ store()

template<class T , int M, int N = M>
__host__ __device__ void roccv::detail::math::Matrix< T, M, N >::store ( T *  data)
inline

Stores data from the matrix into a 1D array in row-major order.

Parameters
dataThe array to store matrix data in.

Member Data Documentation

◆ data_

template<class T , int M, int N = M>
Vector<T, N> roccv::detail::math::Matrix< T, M, N >::data_[M]

The documentation for this class was generated from the following file:
  • /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/detail/math/math.hpp