matrix.subset: Creates a subset of the matrix along an axis.

View source: R/matrix.R

matrix.subsetR 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 = 1, n_threads = 1)

Arguments

mat

The adelie matrix to subset.

indices

Vector of indices to subset the matrix.

axis

The axis along which to subset (2 is columns, 1 is rows).

n_threads

Number of threads.

Value

Matrix subsetted along the appropriate axis. The object is an S4 class with methods for efficient computation by adelie.

Author(s)

James Yang, Trevor Hastie, and Balasubramanian Narasimhan
Maintainer: Trevor Hastie hastie@stanford.edu

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=1)
out <- matrix.subset(X, indices, axis=2)

adelie documentation built on Sept. 11, 2024, 6:36 p.m.