pub fn scatter_reduce(
src: &[f64],
index: &[usize],
num_targets: usize,
op: MessagePassingOp,
) -> Result<Vec<f64>, SparseError>Expand description
Scatter-reduce operation.
For each position i in src, the value src[i] is aggregated into
output[index[i]] using the specified MessagePassingOp.
§Arguments
src– Source values to scatter.index– Target indices; must have same length assrc.num_targets– Size of the output vector.op– Aggregation operation.
§Errors
Returns SparseError::DimensionMismatch if src and index differ in length.
Returns SparseError::InvalidArgument if any index is out of bounds.