asRow: Turn a numeric vector into a single-row or single-column...

View source: R/nimbleFunction_Rexecution.R

asRowR Documentation

Turn a numeric vector into a single-row or single-column matrix

Description

Turns a numeric vector into a matrix that has 1 row or 1 column. Part of NIMBLE language.

Usage

asRow(x)

asCol(x)

Arguments

x

Numeric to be turned into a single row or column matrix

Details

In the NIMBLE language, some automatic determination of how to turn vectors into single-row or single-column matrices is done. For example, in A %*% x, where A is a matrix and x a vector, x will be turned into a single-column matrix unless it is known at compile time that A is a single column, in which case x will be turned into a single-row matrix. However, if it is desired that x be turned into a single row but A cannot be determined at compile time to be a single column, then one can use A %*% asRow(x) to force this conversion.

Author(s)

Perry de Valpine


nimble documentation built on March 18, 2022, 8:03 p.m.