Learn R Programming

meshed (version 0.2.3)

summary_list_mean: Arithmetic mean of matrices in a list

Description

For a list of matrices \(\{ X^{(1)}, \dots, X^{(L)} \}\), all of the same dimension, this function computes the matrix \(\bar{X}\) with \(i,j\) entry \( \bar{X}_{i,j} = \frac{1}{L}\sum_{ l=1 }^{L} X_{ i,j }^{(l)} \). This function does not run any check on the dimensions and uses OpenMP if available.

Usage

summary_list_mean(x, n_threads=1)

Value

The matrix of mean values.

Arguments

x

A list of matrices of the same dimension

n_threads

integer number of OpenMP threads. This is ineffective if meshed was not compiled with OpenMP support.

Author

Michele Peruzzi michele.peruzzi@duke.edu

Examples

Run this code
# make some data into a list
set.seed(2021)
L <- 200
x <- lapply(1:L, function(i) matrix(runif(300), ncol=3)) 
mean_done <- summary_list_mean(x)

Run the code above in your browser using DataLab