matrix.subset {adelie}R Documentation

Creates a subset of the matrix along an axis.

Description

Creates a subset of the matrix along an axis.

Usage

matrix.subset(mat, indices, axis = 0, n_threads = 1)

Arguments

mat

The matrix to subset.

indices

Array of indices to subset the matrix.

axis

The axis along which to subset.

n_threads

Number of threads.

Value

Subset of the matrix along an axis.

Examples

n <- 100
p <- 20
X <- matrix.dense(matrix(rnorm(n * p), n, p))
indices <- c(1, 3, 10)
out <- matrix.subset(X, indices, axis=0)
out <- matrix.subset(X, indices, axis=1)

[Package adelie version 1.0.1 Index]