util.matrix {CHNOSZ}R Documentation

Functions for Various Matrix Operations


Find rows of a matrix that form invertible (linearly independent) combinations.


  invertible.combs(A, nmax=20)



A matrix, with at least as many rows as columns.


The maximum number of rows to consider.


Given a matrix A, with number of rows equal to or greater than the number of columns, return the combinations of row numbers that constitute invertible square matrices. Consider only the first nmax rows of the original matrix (to save time for large systems).


## what combinations of the 20 common amino acids have
## a linearly independent stoichiometry with five elements?
# the names of the amino acids
aanames <- aminoacids("")
# their species indices
iaa <- suppressMessages(info(aanames))
# the full stoichiometric matrix
A <- i2A(iaa)
# the invertible combinations
icA <- invertible.combs(A)
# that's a bit less than 40% of all possible combinations
nrow(icA) / ncol(combn(20, 5))
# count the occurrences of each amino acid
counts <- table(icA)
names(counts) <- aminoacids(1)
(sc <- sort(counts))
# the two sulfur-containing ones show up most frequently
stopifnot(tail(names(sc), 2)==c("C", "M"))

[Package CHNOSZ version 1.1.0 Index]