bnmf-algs
Namespaces | Enumerations | Functions
util.hpp File Reference

Go to the source code of this file.

Namespaces

 bnmf_algs
 Main namespace for bnmf-algs library.
 
 bnmf_algs::details
 Namespace that contains types and functions for internal computations.
 
 bnmf_algs::util
 Namespace for general purpose utility functions to be used by all bnmf_algs functions.
 

Enumerations

enum  bnmf_algs::util::NormType { bnmf_algs::util::NormType::L1, bnmf_algs::util::NormType::L2, bnmf_algs::util::NormType::Inf }
 Type of the norm to be used by bnmf_algs::util::normalize and bnmf_algs::util::normalized. More...
 

Functions

template<typename IntIterator >
void bnmf_algs::details::right_partition (IntIterator begin, IntIterator end, IntIterator all_begin, IntIterator all_end, std::vector< std::pair< size_t, size_t >> &change_indices)
 Partition the number stored at the beginning of the given sequence towards the end of the sequence by computing new partitions using exactly one increment and one decrement operations. More...
 
template<typename IntIterator >
void bnmf_algs::details::left_partition (IntIterator begin, IntIterator end, IntIterator all_begin, IntIterator all_end, std::vector< std::pair< size_t, size_t >> &change_indices)
 Partition the number stored at the end of the given sequence towards the beginning of the sequence by computing new partitions using exactly one increment and one decrement operations. More...
 
template<typename Function , typename Tuple , size_t... I>
auto bnmf_algs::util::call (Function f, Tuple t, std::index_sequence< I... > seq)
 Forward the selected elements of a tuple to a function and return the result. More...
 
template<typename Function , typename Tuple >
auto bnmf_algs::util::call (Function f, Tuple t)
 Forward the elements of a tuple to a function and return the result. More...
 
template<typename T >
double bnmf_algs::util::sparseness (const tensor_t< T, 3 > &S)
 Compute the sparseness of the given 3D tensor. More...
 
template<typename Scalar , int N>
void bnmf_algs::util::normalize (tensor_t< Scalar, N > &input, size_t axis, NormType type=NormType::L1, double eps=1e-50)
 Normalize a tensor in-place along the given axis. More...
 
template<typename Scalar , int N>
tensor_t< Scalar, N > bnmf_algs::util::normalized (const tensor_t< Scalar, N > &input, size_t axis, NormType type=NormType::L1, double eps=1e-50)
 Return a normalized copy of a tensor along the given axis. More...
 
template<typename Real >
Real bnmf_algs::util::psi_appr (Real x)
 Calculate digamma function approximately using the first 8 terms of the asymptotic expansion of digamma function. More...
 
template<typename Integer >
std::vector< std::pair< size_t, size_t > > bnmf_algs::util::partition_change_indices (Integer n, Integer k)
 Compute the sequence of indices to be incremented and decremented to generate all partitions of number n into k bins. More...
 
template<typename Integer >
std::vector< std::vector< Integer > > bnmf_algs::util::all_partitions (Integer n, Integer k)
 Compute all possible k length partitions of given number n. More...