5#ifndef LIBQE_NORMALIZATION_HPP
6#define LIBQE_NORMALIZATION_HPP
23 arma::mat out(m.n_rows, m.n_cols, arma::fill::zeros);
24 for (arma::uword r = 0; r < m.n_rows; r++) {
25 double len = arma::norm(m.row(r), 2);
26 if (std::isfinite(len) && len > 0.0) out.row(r) = m.row(r) / len;
44 for (arma::uword r = 0; r < m.n_rows; r++) {
45 double len = arma::norm(m.row(r), 2);
46 if (std::isfinite(len)) largest = std::max(largest, len);
48 if (largest > 0.0) m /= largest;
Definition adjacency.hpp:16
arma::mat normalize_networks(arma::mat m)
Normalize each row to unit L2 norm (project onto the unit hypersphere).
Definition normalization.hpp:22
arma::mat scale_networks(arma::mat m)
Scale every entry by the reciprocal of the largest row L2 norm.
Definition normalization.hpp:42