glucat  0.12.0
Classes | Typedefs | Functions
glucat::matrix Namespace Reference

Classes

struct  eig_genus
 Structure containing classification of eigenvalues. More...
 

Typedefs

using eig_case_t = enum { safe_eigs, neg_real_eigs, both_eigs}
 Classification of eigenvalues of a matrix. More...
 

Functions

template<typename LHS_T , typename RHS_T >
auto kron (const LHS_T &lhs, const RHS_T &rhs) -> const RHS_T
 Kronecker tensor product of matrices - as per Matlab kron. More...
 
template<typename LHS_T , typename RHS_T >
auto mono_kron (const LHS_T &lhs, const RHS_T &rhs) -> const RHS_T
 Sparse Kronecker tensor product of monomial matrices. More...
 
template<typename LHS_T , typename RHS_T >
auto nork (const LHS_T &lhs, const RHS_T &rhs, const bool mono=true) -> const RHS_T
 Left inverse of Kronecker product. More...
 
template<typename LHS_T , typename RHS_T >
auto signed_perm_nork (const LHS_T &lhs, const RHS_T &rhs) -> const RHS_T
 Left inverse of Kronecker product where lhs is a signed permutation matrix. More...
 
template<typename Matrix_T >
auto nnz (const Matrix_T &m) -> typename Matrix_T::size_type
 Number of non-zeros. More...
 
template<typename Matrix_T >
auto isinf (const Matrix_T &m) -> bool
 Infinite. More...
 
template<typename Matrix_T >
auto isnan (const Matrix_T &m) -> bool
 Not a Number. More...
 
template<typename Matrix_T >
auto unit (const typename Matrix_T::size_type n) -> const Matrix_T
 Unit matrix - as per Matlab eye. More...
 
template<typename LHS_T , typename RHS_T >
auto mono_prod (const ublas::matrix_expression< LHS_T > &lhs, const ublas::matrix_expression< RHS_T > &rhs) -> const typename RHS_T::expression_type
 Product of monomial matrices. More...
 
template<typename LHS_T , typename RHS_T >
auto sparse_prod (const ublas::matrix_expression< LHS_T > &lhs, const ublas::matrix_expression< RHS_T > &rhs) -> const typename RHS_T::expression_type
 Product of sparse matrices. More...
 
template<typename LHS_T , typename RHS_T >
auto prod (const ublas::matrix_expression< LHS_T > &lhs, const ublas::matrix_expression< RHS_T > &rhs) -> const typename RHS_T::expression_type
 Product of matrices. More...
 
template<typename Scalar_T , typename LHS_T , typename RHS_T >
auto inner (const LHS_T &lhs, const RHS_T &rhs) -> Scalar_T
 Inner product: sum(x(i,j)*y(i,j))/x.nrows() More...
 
template<typename Matrix_T >
auto norm_frob2 (const Matrix_T &val) -> typename Matrix_T::value_type
 Square of Frobenius norm. More...
 
template<typename Matrix_T >
auto trace (const Matrix_T &val) -> typename Matrix_T::value_type
 Matrix trace. More...
 
template<typename Matrix_T >
auto eigenvalues (const Matrix_T &val) -> std::vector< std::complex< double > >
 Eigenvalues of a matrix. More...
 
template<typename Matrix_T >
auto classify_eigenvalues (const Matrix_T &val) -> eig_genus< Matrix_T >
 Classify the eigenvalues of a matrix. More...
 
template<typename LHS_T , typename RHS_T >
void nork_range (RHS_T &result, const typename LHS_T::const_iterator2 lhs_it2, const RHS_T &rhs, const typename RHS_T::size_type res_s1, const typename RHS_T::size_type res_s2)
 Utility routine for nork: calculate result for a range of indices. More...
 
template<typename Matrix_T >
static auto to_lapack (const Matrix_T &val) -> ublas::matrix< double, ublas::column_major >
 Convert matrix to LAPACK format. More...
 

Typedef Documentation

◆ eig_case_t

using glucat::matrix::eig_case_t = typedef enum { safe_eigs, neg_real_eigs, both_eigs}

Classification of eigenvalues of a matrix.

Definition at line 136 of file matrix.h.

Function Documentation

◆ classify_eigenvalues()

template<typename Matrix_T >
auto glucat::matrix::classify_eigenvalues ( const Matrix_T &  val) -> eig_genus<Matrix_T>

◆ eigenvalues()

template<typename Matrix_T >
auto glucat::matrix::eigenvalues ( const Matrix_T &  val) -> std::vector< std::complex<double> >

Eigenvalues of a matrix.

Definition at line 500 of file matrix_imp.h.

References to_lapack().

Referenced by classify_eigenvalues().

◆ inner()

template<typename Scalar_T , typename LHS_T , typename RHS_T >
auto glucat::matrix::inner ( const LHS_T &  lhs,
const RHS_T &  rhs 
) -> Scalar_T

Inner product: sum(x(i,j)*y(i,j))/x.nrows()

Inner product: sum(lhs(i,j)*rhs(i,j))/lhs.nrows()

Definition at line 373 of file matrix_imp.h.

References PyClical::lhs, and PyClical::rhs.

◆ isinf()

template<typename Matrix_T >
auto glucat::matrix::isinf ( const Matrix_T &  m) -> bool

Infinite.

Definition at line 275 of file matrix_imp.h.

◆ isnan()

template<typename Matrix_T >
auto glucat::matrix::isnan ( const Matrix_T &  m) -> bool

Not a Number.

Definition at line 292 of file matrix_imp.h.

Referenced by glucat::matrix_log(), and glucat::operator/().

◆ kron()

template<typename LHS_T , typename RHS_T >
auto glucat::matrix::kron ( const LHS_T &  lhs,
const RHS_T &  rhs 
) -> const RHS_T

Kronecker tensor product of matrices - as per Matlab kron.

Definition at line 83 of file matrix_imp.h.

References PyClical::lhs, and PyClical::rhs.

Referenced by glucat::framed_multi< Scalar_T, LO, HI, Tune_P >::fast().

◆ mono_kron()

template<typename LHS_T , typename RHS_T >
auto glucat::matrix::mono_kron ( const LHS_T &  lhs,
const RHS_T &  rhs 
) -> const RHS_T

Sparse Kronecker tensor product of monomial matrices.

Definition at line 119 of file matrix_imp.h.

References PyClical::lhs, and PyClical::rhs.

Referenced by glucat::gen::generator_table< Matrix_T >::gen_from_pm1_qm1().

◆ mono_prod()

template<typename LHS_T , typename RHS_T >
auto glucat::matrix::mono_prod ( const ublas::matrix_expression< LHS_T > &  lhs,
const ublas::matrix_expression< RHS_T > &  rhs 
) -> const typename RHS_T::expression_type

◆ nnz()

template<typename Matrix_T >
auto glucat::matrix::nnz ( const Matrix_T &  m) -> typename Matrix_T::size_type

Number of non-zeros.

Definition at line 258 of file matrix_imp.h.

Referenced by glucat::framed_multi< Scalar_T, LO, HI, Tune_P >::framed_multi().

◆ nork()

template<typename LHS_T , typename RHS_T >
auto glucat::matrix::nork ( const LHS_T &  lhs,
const RHS_T &  rhs,
const bool  mono = true 
) -> const RHS_T

Left inverse of Kronecker product.

Definition at line 182 of file matrix_imp.h.

References PyClical::lhs, norm_frob2(), and PyClical::rhs.

◆ nork_range()

template<typename LHS_T , typename RHS_T >
void glucat::matrix::nork_range ( RHS_T &  result,
const typename LHS_T::const_iterator2  lhs_it2,
const RHS_T &  rhs,
const typename RHS_T::size_type  res_s1,
const typename RHS_T::size_type  res_s2 
)

Utility routine for nork: calculate result for a range of indices.

Definition at line 152 of file matrix_imp.h.

References PyClical::rhs, and glucat::numeric_traits< Scalar_T >::to_scalar_t().

◆ norm_frob2()

template<typename Matrix_T >
auto glucat::matrix::norm_frob2 ( const Matrix_T &  val) -> typename Matrix_T::value_type

Square of Frobenius norm.

Definition at line 395 of file matrix_imp.h.

Referenced by nork().

◆ prod()

template<typename LHS_T , typename RHS_T >
auto glucat::matrix::prod ( const ublas::matrix_expression< LHS_T > &  lhs,
const ublas::matrix_expression< RHS_T > &  rhs 
) -> const typename RHS_T::expression_type
inline

Product of matrices.

Definition at line 361 of file matrix_imp.h.

References PyClical::lhs, and PyClical::rhs.

◆ signed_perm_nork()

template<typename LHS_T , typename RHS_T >
auto glucat::matrix::signed_perm_nork ( const LHS_T &  lhs,
const RHS_T &  rhs 
) -> const RHS_T

Left inverse of Kronecker product where lhs is a signed permutation matrix.

Definition at line 228 of file matrix_imp.h.

References PyClical::lhs, and PyClical::rhs.

Referenced by glucat::fast().

◆ sparse_prod()

template<typename LHS_T , typename RHS_T >
auto glucat::matrix::sparse_prod ( const ublas::matrix_expression< LHS_T > &  lhs,
const ublas::matrix_expression< RHS_T > &  rhs 
) -> const typename RHS_T::expression_type
inline

Product of sparse matrices.

Definition at line 350 of file matrix_imp.h.

References PyClical::lhs, and PyClical::rhs.

◆ to_lapack()

template<typename Matrix_T >
static auto glucat::matrix::to_lapack ( const Matrix_T &  val) -> ublas::matrix<double, ublas::column_major>
static

Convert matrix to LAPACK format.

Definition at line 440 of file matrix_imp.h.

Referenced by eigenvalues().

◆ trace()

template<typename Matrix_T >
auto glucat::matrix::trace ( const Matrix_T &  val) -> typename Matrix_T::value_type

Matrix trace.

Definition at line 416 of file matrix_imp.h.

References glucat::numeric_traits< Scalar_T >::NaN().

◆ unit()

template<typename Matrix_T >
auto glucat::matrix::unit ( const typename Matrix_T::size_type  n) -> const Matrix_T
inline

Unit matrix - as per Matlab eye.

Definition at line 310 of file matrix_imp.h.