bop: Bloc Operation in Place

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

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:

sop is one off: "=" (copy src to dst[]), "+=", "-=", "*=", "/="

Usage

1
bop(dst, mv, sop, src)

Arguments

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)

Value

None

Examples

1
2
3
4
5
6
7
8
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

multbxxc documentation built on Nov. 15, 2019, 5:10 p.m.