CNum 0.2.1
CPU-optimized ML library for C++
Loading...
Searching...
No Matches
CNum::DataStructs::IndexMask Class Reference

A list of indecies representing a subset or ordering of data. More...

#include <IndexMask.h>

Public Member Functions

 IndexMask ()=delete
 IndexMask (::std::unique_ptr< size_t[]> mask, size_t size)
 Constructor.
 IndexMask (const IndexMask &other) noexcept
 Copy constructor.
IndexMaskoperator= (const IndexMask &other) noexcept
 Copy equals operator.
 IndexMask (IndexMask &&other) noexcept
 Move constructor.
IndexMaskoperator= (IndexMask &&other) noexcept
 Move equals operator.
template<typename T>
::CNum::DataStructs::Matrix< T > matrix_apply_mask (const ::CNum::DataStructs::Matrix< T > &m) const
 Apply an index mask to a Matrix.
template<typename T>
::CNum::DataStructs::Matrix< T > matrix_apply_mask_col_wise (const ::CNum::DataStructs::Matrix< T > &m) const
 Apply an index mask to a Matrix column wise.
template<typename T>
::CNum::DataStructs::Matrix< T > matrix_apply_mask (const ::CNum::DataStructs::Matrix< T > &m) const
template<typename T>
::CNum::DataStructs::Matrix< T > matrix_apply_mask_col_wise (const ::CNum::DataStructs::Matrix< T > &m) const

Static Public Member Functions

template<typename Container, typename T, typename CompareFunction = ::std::greater<T>>
static IndexMask argsort (const Container &container)
 Create an index mask.

Detailed Description

A list of indecies representing a subset or ordering of data.

The index mask at its core is a list of indeces that can be used to reorder and get subsets of datasets.

Constructor & Destructor Documentation

◆ IndexMask() [1/4]

CNum::DataStructs::IndexMask::IndexMask ( )
delete

◆ IndexMask() [2/4]

CNum::DataStructs::IndexMask::IndexMask ( ::std::unique_ptr< size_t[]> mask,
size_t size )

Constructor.

◆ IndexMask() [3/4]

CNum::DataStructs::IndexMask::IndexMask ( const IndexMask & other)
noexcept

Copy constructor.

◆ IndexMask() [4/4]

CNum::DataStructs::IndexMask::IndexMask ( IndexMask && other)
noexcept

Move constructor.

Member Function Documentation

◆ argsort()

template<typename Container, typename T, typename CompareFunction>
IndexMask CNum::DataStructs::IndexMask::argsort ( const Container & container)
static

Create an index mask.

Template Parameters
Containeran STL container or a Matrix
TThe data type stored in Container
CompareFunctionThe function used to sort (greater by default)

◆ matrix_apply_mask() [1/2]

template<typename T>
::CNum::DataStructs::Matrix< T > CNum::DataStructs::IndexMask::matrix_apply_mask ( const ::CNum::DataStructs::Matrix< T > & m) const

Apply an index mask to a Matrix.

Applying an index mask creates a new Matrix using the rows of the first that appear in the index mask, in the order they appear

Template Parameters
TThe data type of the Matrix
Returns
The masked Matrix

◆ matrix_apply_mask() [2/2]

template<typename T>
::CNum::DataStructs::Matrix< T > CNum::DataStructs::IndexMask::matrix_apply_mask ( const ::CNum::DataStructs::Matrix< T > & m) const

◆ matrix_apply_mask_col_wise() [1/2]

template<typename T>
::CNum::DataStructs::Matrix< T > CNum::DataStructs::IndexMask::matrix_apply_mask_col_wise ( const ::CNum::DataStructs::Matrix< T > & m) const

Apply an index mask to a Matrix column wise.

Applying an index mask column wise creates a new Matrix using the columns of the first that appear in the index mask, in the order they appear

Template Parameters
TThe data type of the Matrix
Returns
The masked Matrix

◆ matrix_apply_mask_col_wise() [2/2]

template<typename T>
::CNum::DataStructs::Matrix< T > CNum::DataStructs::IndexMask::matrix_apply_mask_col_wise ( const ::CNum::DataStructs::Matrix< T > & m) const

◆ operator=() [1/2]

IndexMask & CNum::DataStructs::IndexMask::operator= ( const IndexMask & other)
noexcept

Copy equals operator.

◆ operator=() [2/2]

IndexMask & CNum::DataStructs::IndexMask::operator= ( IndexMask && other)
noexcept

Move equals operator.


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