# big_cprodVec: Cross-product with a vector In bigstatsr: Statistical Tools for Filebacked Big Matrices

## Description

Cross-product between a Filebacked Big Matrix and a vector.

## Usage

 1 2 3 4 5 6 7 8 9 big_cprodVec( X, y.row, ind.row = rows_along(X), ind.col = cols_along(X), center = NULL, scale = NULL, ncores = 1 ) 

## Arguments

 X An object of class FBM. y.row A vector of same size as ind.row. ind.row An optional vector of the row indices that are used. If not specified, all rows are used. Don't use negative indices. ind.col An optional vector of the column indices that are used. If not specified, all columns are used. Don't use negative indices. center Vector of same length of ind.col to subtract from columns of X. scale Vector of same length of ind.col to divide from columns of X. ncores Number of cores used. Default doesn't use parallelism. You may use nb_cores.

X^T \cdot y.

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 X <- big_attachExtdata() n <- nrow(X) m <- ncol(X) y <- rnorm(n) test <- big_cprodVec(X, y) # vector true <- crossprod(X[], y) # one-column matrix all.equal(test, as.numeric(true)) # subsetting ind.row <- sample(n, n/2) ind.col <- sample(m, m/2) tryCatch(test2 <- big_cprodVec(X, y, ind.row, ind.col), error = function(e) print(e)) # returns an error. You need to use the subset of y: test2 <- big_cprodVec(X, y[ind.row], ind.row, ind.col) true2 <- crossprod(X[ind.row, ind.col], y[ind.row]) all.equal(test2, as.numeric(true2)) 

bigstatsr documentation built on April 5, 2021, 5:08 p.m.