matrix-normalize ( m -- m' )
Matrix operations

Prev:<cartesian-square-indices> ( n -- matrix )
Next:mneg ( m -- m' )


Vocabulary
math.matrices

Inputs
ma matrix with at least 1 non-zero number


Outputs
m'a matrix


Word description
Normalize a matrix containing at least 1 non-zero element. Each element from the input matrix is computed as a fraction of the maximum element. The maximum element becomes 1/1.

Notes
This word is intended for use with "flat" (2-dimensional) matrices.
This word assumes that elements of the input matrix are compatible with the following words:
max ( obj1 obj2 -- obj )

abs ( x -- y )

/ ( x y -- z )


Examples
USING: math.matrices prettyprint ; { { 5 9 } { 15 17 } } matrix-normalize .
{ { 5/17 9/17 } { 15/17 1 } }


Definition