bop | R Documentation |
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)
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.