ProductName  

Normalizes the rows of the current matrix according to the specified mode.

Syntax

MatrixObject.NormalizeRows(NormalizeMode)

Parameters

NormalizeMode
Optional. A NormalizeModeEnum value specifying the mode that the matrix rows will be normalized.

The following table describes the possible values for the NormalizeMode parameter.

Constant Description Value
bmModeMaxOne Normalizes columns so that the biggest element in each row is 1. 1
bmModeUnitLength (Default) Normalizes rows so that they become unit length vectors (their sum of squares is 1). 2
bmModeZScores Normalizes rows to z scores (having zero mean and unit standard deviation). 3

Example

This example demonstrates the use of NormalizeRows method. A matrix is defined and then its rows are normalized according to the three different modes.
Private sub MatrixNormalizeRows()

Dim A As Matrix, Norm As Double
    
    Set A = New Matrix
    A.Size 4, 4
    A.FillRandom
    Debug.Print "A ="
    Debug.Print A.GetString
    
    A.NormalizeRows bmModeMaxOne
    Debug.Print "NormalizeMode = bmModeMaxOne"
    Debug.Print A.GetString
    A.NormalizeRows bmModeUnitLen
    Debug.Print "NormalizeMode = bmModeUnitLength"
    Debug.Print A.GetString
    A.NormalizeRows bmModeZScores
    Debug.Print "NormalizeMode = bmModeZScores"
    Debug.Print A.GetString
    
End Sub

Output

A =
| 6.000 2.000 8.000 6.000 |
| 5.000 4.000 9.000 8.000 |
| 7.000 2.000 9.000 7.000 |
| 5.000 3.000 0.000 1.000 |

NormalizeMode = bmModeMaxOne
| 0.750 0.250 1.000 0.750 |
| 0.556 0.444 1.000 0.889 |
| 0.778 0.222 1.000 0.778 |
| 1.000 0.600 0.000 0.200 |

NormalizeMode = bmModeUnitLength
| 0.507 0.169 0.676 0.507 |
| 0.367 0.293 0.660 0.587 |
| 0.517 0.148 0.665 0.517 |
| 0.845 0.507 0.000 0.169 |

NormalizeMode = bmModeZScores
|  0.229 -1.606  1.147  0.229 |
| -0.728 -1.213  1.213  0.728 |
|  0.290 -1.643  1.063  0.290 |
|  1.432  0.391 -1.172 -0.651 |

See Also

NormalizeMe Method

Applies To: Matrix