bigmatrix-operations: Matrix and arithmetic operations for big.matrix objects

bigmatrix-operationsR Documentation

Matrix and arithmetic operations for big.matrix objects

Description

These methods extend the base matrix multiplication operator (%*%) and the group generic Arithmetic so that big.matrix objects can interoperate with base R matrices and numeric scalars using the high-performance routines provided by bigalgebra.

Usage

## S4 method for signature 'big.matrix,big.matrix'
x %*% y

## S4 method for signature 'matrix,big.matrix'
x %*% y

## S4 method for signature 'big.matrix,matrix'
x %*% y

## S4 method for signature 'big.matrix,big.matrix'
Arith(e1, e2)

## S4 method for signature 'big.matrix,matrix'
Arith(e1, e2)

## S4 method for signature 'matrix,big.matrix'
Arith(e1, e2)

## S4 method for signature 'numeric,big.matrix'
Arith(e1, e2)

## S4 method for signature 'big.matrix,numeric'
Arith(e1, e2)

Arguments

x, y

Matrix operands supplied either as big.matrix instances or base R matrices, depending on the method signature.

e1, e2

Numeric operands, which may be big.matrix objects, base R matrices, or numeric scalars depending on the method signature.

Details

Matrix multiplications dispatch to bigalgebra::dgemm(), mixed arithmetic on matrices relies on bigalgebra::daxpy(), and scalar/matrix combinations use bigalgebra::dadd() when appropriate.

See Also

bigmemory::big.matrix(), bigalgebra::dgemm(), bigalgebra::daxpy(), bigalgebra::dadd()

Examples

if (requireNamespace("bigmemory", quietly = TRUE) &&
    requireNamespace("bigalgebra", quietly = TRUE)) {
  x <- bigmemory::big.matrix(2, 2, init = 1)
  y <- bigmemory::big.matrix(2, 2, init = 2)
  x %*% y
  x + y
  x * 3
}


bigPLScox documentation built on Nov. 18, 2025, 5:06 p.m.