libqe 0.2.6-dev.9001
QE C++ library
Loading...
Searching...
No Matches
adjacency.hpp File Reference

Combinatorics and vector/matrix utilities for ENA connection networks. More...

#include <armadillo>
#include <string>
#include <vector>
#include <cmath>

Go to the source code of this file.

Namespaces

namespace  qe
 

Functions

Combinatorics
int qe::choose_two (int n)
 Number of unordered pairs from n items (n choose 2).
 
int qe::n_connections (int n, bool diagonal=false)
 Number of undirected connection columns for n codes.
 
arma::umat qe::connection_indices (int len, int row=-1, bool diagonal=false)
 Upper-triangle index pairs for a symmetric matrix of side len.
 
Vector ↔ upper-triangle conversions
arma::rowvec qe::code_connections (arma::mat v)
 Compute pairwise products and return as a flat upper-triangle vector.
 
arma::rowvec qe::fold_directed_network (arma::vec v, bool diagonal=false)
 Fold a directed n² vector into an undirected upper-triangle vector.
 
arma::rowvec qe::network_to_vector (arma::mat x, bool full=true, bool diagonal=false)
 Flatten an adjacency matrix to a vector.
 
String utilities
std::vector< std::string > qe::connection_names (std::vector< std::string > v, bool diagonal=false)
 Generate "A & B" pair names for every upper-triangle position.
 

Detailed Description

Combinatorics and vector/matrix utilities for ENA connection networks.

Pure C++ / Armadillo — no Rcpp dependency. Include <RcppArmadillo.h> before this header when building inside an R package.