Title: | Auxiliary Routines for Influx Software |
---|---|
Description: | Contains auxiliary routines for influx software. This packages is not intended to be used directly. Influx was published here: Sokol et al. (2012) <doi:10.1093/bioinformatics/btr716>. |
Authors: | Serguei Sokol |
Maintainer: | Serguei Sokol <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.3 |
Built: | 2024-11-24 03:08:25 UTC |
Source: | https://github.com/cran/multbxxc |
src array is added (if sop=="+=") to dst[...] or any other manipulation is made according to sop parameter Both arrays are supposed to be of type 'double' The operation is done 'in place' without new memory allocation for dst src is reshaped and possibly replicated to fit the designated block of dst. mv can be:
a 1 or 3 component vector describing the block: 1-margin number of dst, 2-offset, 3-length if only the margin is present than offest is 0 and length is the total length of this margin
a matrix of indexes. Its column number must be equal to the length(dim(dst))) each row of this matrix is a multidimensional index in dst array.
sop is one off: "=" (copy src to dst[]), "+=", "-=", "*=", "/="
bop(dst, mv, sop, src)
bop(dst, mv, sop, src)
dst |
A numeric array, destination |
mv |
An integer vector or matrix, describe margins to operate on |
sop |
A string, describes an operator to apply |
src |
A numeric array, source (may be replicated to fit the size of dst) |
None
a=matrix(1, 3, 3) # 3x3 matrix of 1's b=1:3 bop(a, 2, "+=", b) # a += b, here b will be repeated a # [,1] [,2] [,3] # [1,] 2 2 2 # [2,] 3 3 3 # [3,] 4 4 4
a=matrix(1, 3, 3) # 3x3 matrix of 1's b=1:3 bop(a, 2, "+=", b) # a += b, here b will be repeated a # [,1] [,2] [,3] # [1,] 2 2 2 # [2,] 3 3 3 # [3,] 4 4 4
Transforms a couple of index vectors ir and jc (ij of a sparse matrix)
with possibly repeated values into sparse indexes i,j and a vector of 1d indexes of non zero values.
The response can be then used for repeated creation of sparse
matrices with the same pattern by calling iv2v()
ir and jc are supposed to be sorted in increasing order, column-wise (ic runs first)
ij2ijv_i(ir, jc)
ij2ijv_i(ir, jc)
ir |
An integer vector, row indexes |
jc |
An integer vector, column indexes |
A list with fields i, j and iv
sum values in v according to possibly repeated indexes in iv
iv2v(iv, v)
iv2v(iv, v)
iv |
An integer vector, obtained with |
v |
A numeric vector |
Numeric vector
Update Matrix by a Cascade of Dot Product
jrhs_ff(jrhs, ff, xpfw)
jrhs_ff(jrhs, ff, xpfw)
jrhs |
A sparse matrix of type slam |
ff |
A sparse matrix of type slam |
xpfw |
A numeric matrix |
Match ix,jx-couple in ti,tj-table and return their 1-based positions (0 for non matched couples)
match_ij(ix, jx, ti, tj)
match_ij(ix, jx, ti, tj)
ix |
An integer vector |
jx |
An integer vector |
ti |
An integer vector |
tj |
An integer vector |
An integer vector
match_ij(1:2, 1:2, 0:4, 0:4) # [1] 2 3
match_ij(1:2, 1:2, 0:4, 0:4) # [1] 2 3
Dot product of simple triplet matrix x (m x n) (measurement matrix) and a dense array y (n x k x l). Only slices of y_ from lsel vector are used.
mm_xpf(x, y_, lsel)
mm_xpf(x, y_, lsel)
x |
A list, sparse matrix of type slam |
y_ |
A numeric 3d array |
lsel |
An integer vector |
An array with dimensions (m x len(lsel) x k), i.e. it is permuted on the fly.
Calculate Inplace a Series of Dot Product
mult_bxxc(a, b, c)
mult_bxxc(a, b, c)
a |
A dense array, the size of a is (nr_b, nc_c, ntico) |
b |
A sparse matrix (cf. simple_triplet_matrix) of size (nr_b*ntico, nc_b) given by its fields v, i, and j describing triplet storage. |
c |
A dense array, the size of c is (ldc, nc_c, ntico), ldc must be >= ncol(b) |
None
The multbxxc package provides a series C++ function most often operating inplace
metabolic flux analysis (MFA)
Serguei Sokol
Sokol et al. (2012) <doi:10.1093/bioinformatics/btr716>
Write new dimension vector while keeping the old memory
redim(x, di)
redim(x, di)
x |
A numeric array |
di |
An integer vector, new dimensions |
None
a=matrix(as.double(1:12), 6, 2) redim(a, c(3, 4)) dim(a) # [1] 3 4
a=matrix(as.double(1:12), 6, 2) redim(a, c(3, 4)) dim(a) # [1] 3 4
The system is defined as where M is a diagonal
matrix given by its diagonal vector M (which has a form of matrix for
term-by-term multiplication with x0)
In discrete terms
The rmumps matrix
is stored in list ali as XPtr<Rmumps>
or a plain dense inverted matrix.
Calculations are done in-place so s is modified and contains the
solution on exit. The others parameters are not modified.
solve_ieu(invdt, x0_, M, ali, s, ilua)
solve_ieu(invdt, x0_, M, ali, s, ilua)
invdt |
A numeric vactor, represents 1/dt |
x0_ |
A numeric matrix or NULL, is the starting value at t0 (NULL means 0) |
M |
A numeric matrix representing diagonal terms (masses) |
ali |
A list of matrices or Rmumps objects |
s |
A 3d numeric array, is the source term, its last margin corresponds to time. |
ilua |
An integer vector, |
None