# util.matrix: Functions for Various Matrix Operations In CHNOSZ: Thermodynamic Calculations for Geobiochemistry

## Description

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

## Usage

 `1` ``` invertible.combs(A, nmax=20) ```

## Arguments

 `A` A matrix, with at least as many rows as columns. `nmax` The maximum number of rows to consider.

## Details

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).

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19``` ```## 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) stopifnot(nrow(icA)==6067) # 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")) ```

CHNOSZ documentation built on Nov. 17, 2017, 8:03 a.m.