matrixOps.rvec {rvec}R Documentation

Matrix Multiplication with Rvecs

Description

Matrix multiplication %*% can be used with rvecs. However, in constrast to standard R vectors, multiplying an rvec by a matrix does not produce a row or column vector. Instead it produces an ordinary rvec, with no dimensions.

Usage

## S3 method for class 'rvec'
matrixOps(x, y)

Arguments

x, y

Vectors, matrices, or rvecs.

Value

An rvec, if x or y is an rvec.

Examples

A <- matrix(c(10, 10, 10,
              11, 11, 11),
            nrow = 2, byrow = TRUE)
x <- rvec(list(c(1, 2),
               c(3, 4),
               c(5, 6)))
A %*% x

## matrix multiplication with an
## ordinary R matrix produces
## a row or column vector
y <- c(1, 3, 5)
A %*% y

[Package rvec version 0.0.6 Index]