matrix max

For filters.

Find the maximum value in a matrix, or max along an axis.

Command Type

built-in

Signature

> matrix max {flags}

Flags

  • --axis, -a {int}: The axis to find the max along (0-based).

Input/output types:

input output
matrix float
matrix matrix

Examples

Find the maximum element in a matrix

> [[1 2] [3 4]] | into matrix | matrix max
4.0

Find max along rows (axis 0)

> [[1 2] [3 4]] | into matrix | matrix max --axis 0 | matrix into-nu | to nuon
[[3.0, 4.0]]

Find max along columns (axis 1)

> [[1 2] [3 4]] | into matrix | matrix max --axis 1 | matrix into-nu | to nuon
[[2.0, 4.0]]

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.