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

A bit mask used for representing subsets of elements in a container. More...

#include <BinaryMask.h>

Public Member Functions

 BinaryMask ()=delete
 BinaryMask (BitMask mask, size_t size, size_t n_set)
 Overloaded constructor.
 BinaryMask (const BinaryMask &other) noexcept
 Copy constructor.
BinaryMaskoperator= (const BinaryMask &other) noexcept
 Copy equals operator.
 BinaryMask (BinaryMask &&other) noexcept
 Move constructor.
BinaryMaskoperator= (BinaryMask &&other) noexcept
 Move equals operator.
template<typename T>
::CNum::DataStructs::Matrix< T > mask (const ::CNum::DataStructs::Matrix< T > &m) const
 apply the mask to a Matrix
template<typename T>
::CNum::DataStructs::Matrix< T > mask (const CNum::DataStructs::Matrix< T > &m) const

Static Public Member Functions

template<typename T, typename U, typename CompareFunction>
static BinaryMask create_binary_mask (const T &m, U val)
 Create a binary mask.
template<typename T, typename CompareFunction>
static BinaryMask create_binary_mask_matrix (const ::CNum::DataStructs::Matrix< T > &m, T val)
 Create a BinaryMask for a Matrix.

Detailed Description

A bit mask used for representing subsets of elements in a container.

A BinaryMask at its core is a bit mask where the nth bit represents index n in a container of elements. The nth bit being set means the subset that the mask represents preserves that element (or row of elements) at the nth index in the container.

Constructor & Destructor Documentation

◆ BinaryMask() [1/4]

CNum::DataStructs::BinaryMask::BinaryMask ( )
delete

◆ BinaryMask() [2/4]

CNum::DataStructs::BinaryMask::BinaryMask ( BitMask mask,
size_t size,
size_t n_set )

Overloaded constructor.

Parameters
maskThe actual BitMask
sizeThe number of bits in the mask (excluding excess)

◆ BinaryMask() [3/4]

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

Copy constructor.

◆ BinaryMask() [4/4]

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

Move constructor.

Member Function Documentation

◆ create_binary_mask()

template<typename T, typename U, typename CompareFunction>
BinaryMask CNum::DataStructs::BinaryMask::create_binary_mask ( const T & m,
U val )
static

Create a binary mask.

Template Parameters
TThe type of container (holds data type U)
UThe data type stored in the container
CompareFunctionThe function to use for comparison
Returns
A binary mask

◆ create_binary_mask_matrix()

template<typename T, typename CompareFunction>
BinaryMask CNum::DataStructs::BinaryMask::create_binary_mask_matrix ( const ::CNum::DataStructs::Matrix< T > & m,
T val )
static

Create a BinaryMask for a Matrix.

Template Parameters
TThe type of the Matrix
CompareFunctionThe function to use for comparison
Returns
A binary mask

◆ mask() [1/2]

template<typename T>
::CNum::DataStructs::Matrix< T > CNum::DataStructs::BinaryMask::mask ( const ::CNum::DataStructs::Matrix< T > & m) const

apply the mask to a Matrix

Template Parameters
Thetype of the Matrix
Returns
The masked Matrix

◆ mask() [2/2]

template<typename T>
::CNum::DataStructs::Matrix< T > CNum::DataStructs::BinaryMask::mask ( const CNum::DataStructs::Matrix< T > & m) const

◆ operator=() [1/2]

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

Move equals operator.

◆ operator=() [2/2]

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

Copy equals operator.


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