Skip to contents

Compute the mean of rows of x grouped by integer labels, dispatching to GPU when available.

Usage

segment_mean(x, labels, K)

Arguments

x

A numeric matrix or adgeMatrix.

labels

Integer vector of group labels (1-based).

K

Number of groups.

Value

A K-by-ncol(x) matrix of group means.