IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo module

reduction

Implements SIMD reductions.

You can import these APIs from the algorithm package. For example:

from max.algorithm import map_reduce

Functions​

  • ​cumsum: Computes the cumulative sum of all elements in a buffer. dst[i] = src[i] + src[i-1] + ... + src[0].
  • ​map_reduce: Performs a vectorized map-reduce operation over a sequence.
  • ​max: Computes the max element in a buffer.
  • ​mean: Computes the mean value of the elements in a buffer.
  • ​min: Computes the min element in a buffer.
  • ​product: Computes the product of the buffer elements.
  • ​reduce: Computes a custom reduction of buffer elements.
  • ​sum: Computes the sum of buffer elements.
  • ​variance: Given a mean, computes the variance of elements in a buffer.

Was this page helpful?