CMatrix:Normalize
The Normalize method normalizes the CMatrix to a volume of 1.0.
CMatrix:Normalize() |
This method computes a scale factor to adjust the matrix values to a total sum of 1.0. This factor is applied to the CMatrix. If any matrix members are not numbers, the results are probably not meaningful.
The following script fragment normalizes the CMatrix:
M = CMatrix:new() |
-- create a CMatrix |
... |
-- set the matrix weights |
M:Normalize() |
-- compute and apply the normalization factor |
Printf("Vol = %lg", M:Volume()) |
-- result: Vol = 1 |