Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

matrix scale for filters

Multiply all elements of a matrix by a scalar.

Signature

> matrix scale {flags} (scalar)

Parameters

  • scalar: The scalar to multiply each element by.

Input/output types:

inputoutput
matrixmatrix

Examples

Scale a matrix by an integer

> matrix identity 2 | matrix scale 3 | matrix into-nu | to nuon
[[3.0, 0.0], [0.0, 3.0]]

Scale a matrix by a float

> matrix identity 2 | matrix scale 0.5 | matrix into-nu | to nuon
[[0.5, 0.0], [0.0, 0.5]]